I have an embedded elasticsearch using the elasticsearch-jetty project, and I need to setup to use tokenizers better than the defaults. I want to use the keyword tokenizer.<
You can define mappings in the config files, but for most cases it is easier/more flexible to configure through the API. For example, this command will add a keyword/lowercase analyzer to the index test
:
$ curl -XPUT localhost:9200/testindex/ -d '
{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_keyword":{
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
}
},
"mappings":{
"test":{
"properties":{
"title":{
"analyzer":"analyzer_keyword",
"type":"string"
}
}
}
}
}'
To update an existing index, use
$ curl -XPUT localhost:9200/testindex/_settings -d '
{
..........
}
However you can't update non dynamic settings.