Hi,
I previously asked about this but it looks like the last thread was closed.
I basically tried to setup a custom tokenizer on my index using the High Level Rest Client with the following:
CreateIndexRequest createRequest = new CreateIndexRequest(actualIndexName);
createRequest.settings(Settings.builder()
.put("index.number_of_shards", 1)
.put("index.number_of_replicas", 1)
.put("index.max_result_window", 30000)
.put("analysis.tokenizer", "custom_tokenizer")
.put("analysis.tokenizer.custom_tokenizer.type", "ngram")
.put("analysis.tokenizer.custom_tokenizer.min_gram", "1")
.put("analysis.tokenizer.custom_tokenizer.max_gram", "15")
.put("analysis.analyzer", "custom_analyzer")
.put("analysis.analyzer.custom_analyzer.tokenizer", "custom_tokenizer")
.putList("analysis.tokenizer.custom_tokenizer.token_chars", Arrays.asList("letter", "digit"))
);
What I end up with in my index settings is the following:
"settings": {
"index": {
"number_of_shards": "1",
"provided_name": "myIndex",
"max_result_window": "30000",
"creation_date": "1571949868626",
"analysis": {
"custom_tokenizer": {
"type": "ngram"
},
"custom_analyzer": {
"tokenizer": "custom_tokenizer"
},
"analyzer": "custom_analyzer",
"tokenizer": "custom_tokenizer"
},
"number_of_replicas": "1",
"uuid": "jOQz3C-_Rn2sS6-_5G_djA",
"version": {
"created": "7020099"
}
}
}
}
So it looks like some of the ngram details are missing as well as my list of token chars.
I've also clearing out the index and tried updating the settings manually with the same example as here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-ngram-tokenizer.html
But now I keep getting something like this in my response:
{
"error": {
"root_cause": [
{
"type": "resource_already_exists_exception",
"reason": "index [myindex/jOQz3C-_Rn2sS6-_5G_djA] already exists",
"index_uuid": "jOQz3C-_Rn2sS6-_5G_djA",
"index": "dev_rddd0_projects"
}
],
"type": "resource_already_exists_exception",
"reason": "index [myindex/jOQz3C-_Rn2sS6-_5G_djA] already exists",
"index_uuid": "jOQz3C-_Rn2sS6-_5G_djA",
"index": "dev_rddd0_projects"
},
"status": 400
}
What might I be missing?
Cheers,
- Linus