I am using ElasticSearch 1.5.2 and I wish to have the following settings :
"settings": {
"analysis": {
"filter": {
"filter_shingle": {
"type": "shingle",
"max_shingle_size": 2,
"min_shingle_size": 2,
"output_unigrams": false
},
"filter_stemmer": {
"type": "porter_stem",
"language": "English"
}
},
"tokenizer": {
"my_ngram_tokenizer": {
"type": "nGram",
"min_gram": 1,
"max_gram": 1
}
},
"analyzer": {
"ShingleAnalyzer": {
"tokenizer": "my_ngram_tokenizer",
"filter": [
"standard",
"lowercase",
"filter_stemmer",
"filter_shingle"
]
}
}
}
}
Where should I add them? I mean before index creation or after?
By searching online I found some method like
client.admin().indices().prepareCreate("temp_index").setSettings(ImmutableSettings.settingsBuilder().loadFromSource((jsonBuilder()
.startObject()
.startObject("analysis")
.startObject("analyzer")......and so on)
But I am having 2 issues,
I get a compile error : The method loadFromSource in the type ImmutableSettings.builder is not applicable for the arguments XContentBuilder
Also, I don't know how to convert my settings to this format. And where is the documentation to get to know about all these methods? I tried reading the official ElasticSearch JAVA API https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/search.html but I was unable to find anything about setting up analyzers. All the related content I find is only in the form of REST APIs and not in Java API.