Reputation: 2231
I am trying to apply lowercase normalizer while creating a new index through elasticsearch rest client using the below code.
CreateIndexRequest indexRequest = new CreateIndexRequest(index);
//normalizer settings
String settings = "{\"settings\":{\"analysis\":{\"normalizer\":{\"my_normalizer\":{\"type\":\"custom\",\"filter\":[\"lowercase\",\"asciifolding\"]}}}}}";
indexRequest.settings(settings, XContentType.JSON);
indexRequest.mapping(source, XContentType.JSON);
CreateIndexResponse indexResponse = client.indices().create(indexRequest,RequestOptions.DEFAULT);
But i keep getting the below error from elasticsearch.
Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://localhost:9200], URI [/knowledgebase?master_timeout=30s&timeout=30s], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.normalizer.my_normalizer.filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}],"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.normalizer.my_normalizer.filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings","suppressed":[{"type":"illegal_argument_exception","reason":"unknown setting [index.settings.analysis.normalizer.my_normalizer.type] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"}]},"status":400}
at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:253)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:231)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:205)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1454)
I am using elasticsearch version 7.8. When i try to push the same setting via curl it works as expected. Am i missing something here?
Upvotes: 0
Views: 1074
Reputation: 217564
Try removing the settings:{}
section:
String settings = "{\"analysis\":{\"normalizer\":{\"my_normalizer\":{\"type\":\"custom\",\"filter\":[\"lowercase\",\"asciifolding\"]}}}}";
Upvotes: 1