ES query does not support [auto_generate_synonyms_phrase_query]

Posted lianshan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ES query does not support [auto_generate_synonyms_phrase_query]相关的知识,希望对你有一定的参考价值。

测试环境使用  elasticsearch-rest-high-level-client  做为基础包发起es调用出现如下异常:

"error":"root_cause":["type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":337],"type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":337,"status":400
        at org.elasticsearch.client.RestClient$SyncResponseListener.get(RestClient.java:705) ~[elasticsearch-rest-client-6.3.0.jar:6.3.0]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:235) ~[elasticsearch-rest-client-6.3.0.jar:6.3.0]
        at org.elasticsearch.client.RestClient.performRequest(RestClient.java:198) ~[elasticsearch-rest-client-6.3.0.jar:6.3.0]
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:522) ~[elasticsearch-rest-high-level-client-6.3.0.jar:6.3.0]
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:508) ~[elasticsearch-rest-high-level-client-6.3.0.jar:6.3.0]
        at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:404) ~[elasticsearch-rest-high-level-client-6.3.0.jar:6.3.0]
        at com.sf.ccsp.syn

百度发现版本不一致 生产环境使用的es版本是5.4.1。其他答案是版本不一致就让本地的 es版本和服务器的版本保持一致,这的确是一个方法,但是本地封装了很多jar包了,我也尝试了降级但是必须  elasticsearch-rest-high-level-client 版本与elasticsearch版本一同降级,但是 elasticsearch-rest-high-level-client 降到5.x版本还会出现新的问题,和现有的不兼容。

解决办法就是使用6.0.0 的 包 elasticsearch-rest-high-level-client 与elasticsearch  都使用这个版本的包,这个版本MatchQueryBuilder  还没有参数auto_generate_synonyms_phrase_query,MatchPhraseQueryBuilder也没有zero_terms_query多余的参数,详情可以见源码自己查看。

        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.0.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>elasticsearch</artifactId>
                    <groupId>org.elasticsearch</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>6.0.0</version>
        </dependency>

 


以上是关于ES query does not support [auto_generate_synonyms_phrase_query]的主要内容,如果未能解决你的问题,请参考以下文章

client does not support authentication

client does not support authentication

service XXX does not support chkconfig

FlinkThis YARN version does not support getSchedulerResourceTypes

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol ...以及如何打开MySQL终端。

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by serv