How to create tokenizer and analyzer in elasticsearch.yml


(Ngọc Phạm) #1

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!


(Mark Walkom) #2

I don't believe you can do that.


(Ngọc Phạm) #3

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

It impossible??

@warkolm


(Mark Walkom) #4

Create it for what? All indices?


(Christian Dahlqvist) #5

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.


(Ngọc Phạm) #6

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


(Mark Walkom) #7

Then use a template as @Christian_Dahlqvist mentioned.


(system) #8