How to create tokenizer and analyzer in elasticsearch.yml

Hi, im newbie in elasticsearch and i have a question. Please help me :sunny:

i have one command working like this :slightly_smiling:

curl -XPUT 'localhost:9200/number2' -d '

{
"settings" : {
"analysis" : {
"analyzer" : {
"my_ngram_analyzer" : {
"tokenizer" : "my_ngram_tokenizer"
}
},
"tokenizer" : {
"my_ngram_tokenizer" : {
"type" : "nGram",
"min_gram" : "1",
"max_gram" : "1",
"token_chars": [ "letter", "digit" ]
}
}
}
}
}'

Now i want config it in file config elasticsearch.yml . I dont know how to do it
It maybe like this(i tried but error :slightly_smiling: )

index.analysis.analyzer:my_ngram_analyzer
index.analysis.analyzer.my_ngram_analyzer.tokenizer:my_ngram_tokenizer
index.analysis.tokenizer.......

Thanks for your help!

I don't believe you can do that.

i only want create one custom analyzer or one custom tokenizer in file config (or both :)) )

It impossible??

@warkolm

Create it for what? All indices?

This is not managed through the elasticsearch.yml file. You can use an index template if you want this mapping to apply to all or a subset of all created indices. You can also set it for specific indices using the PUT mapping API.

@warkolm yes. All indeces maybe use custom analyzer . It use or not define by mapping properties.

Then use a template as @Christian_Dahlqvist mentioned.

1 Like