我使用的是7.10.2版本的Maven-org-elasticsearch-client_aelasticsearch-rest-high-level-client版本,WildcardQueryBuilder应该使用caseInsensive属性。下面是我的代码片段;Elasticsearch异常[type=parsing_exception,reason=[wildcard]查询不支持[case_insensitic]]"在执行我的ES搜索请求时
private BoolQueryBuilder translateSearchFilter(final Filter filter) {
final BoolQueryBuilder searchQuery = new BoolQueryBuilder();
searchQuery.must(new WildcardQueryBuilder(filter.getDimension(), filter.getQuery().getValue())
.caseInsensitive(!filter.getQuery().isCaseSensitive()));
return searchQuery;
}
异常日志
"exception": " ElasticsearchStatusException[Elasticsearch exception [type=x_content_parse_exception, reason=[1:102] [bool] failed to parse field [must]]]; nested: ElasticsearchException[Elasticsearch exception [type=parsing_exception, reason=[wildcard] query does not support [case_insensitive]]];ntat org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:187)ntat org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1911)ntat org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1888)ntat org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1645)ntat org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1602)ntat org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1572)ntat org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1088)ntat com.amazon.atvomniaservice.elasticsearch.ElasticSearchClient.search(ElasticSearchClient.java:52)ntat com.amazon.atvomniaservice.elasticsearch.ElasticSearchQueryRunner.submit(ElasticSearchQueryRunner.java:30)ntat
我坚信Java客户端版本和集群的版本不同。caseInsensitive
查询参数是在Elasticsearch 7.10版本中首次引入的。
所以我猜你运行的是一个版本低于7.10的Elasticsearch集群。集群不知道这个参数"0";然而";。
我希望我能帮助你。