Search code examples
elasticsearchtokenize

How can I set a tokenizer in elasticsearch.yml config?


What is the proper syntax to set the Whitespace tokenizer instead of the standard one in elasticsearch.yml?


Solution

  • If no analyzer has been specified during index time, it will look for an analyzer in the index settings called default. If, there is no anaylzer like this - it will be defaulted to standard analyzer.

    There is no way to change this behaviour (e.g. replace last fail option).

    So, all you can do is to create index with default analyzer

    PUT my_index
    {
      "settings": {
        "analysis": {
          "analyzer": {
            "default": {
              "tokenizer": "whitespace"
            }
          }
        }
      }
    }