• 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>
    
    
    
    
  • 相关阅读:
    艾伟_转载:ASP.NET缓存 狼人:
    艾伟_转载:VS 2010 和 .NET 4.0 系列之《在VS 2010中查询和导航代码》篇 狼人:
    艾伟_转载:Visual Studio DSL 入门 2 狼人:
    艾伟_转载:VS 2010 和 .NET 4.0 系列之《代码优化的Web开发Profile》篇 狼人:
    艾伟_转载:对ArrayList中的自定义类型进行搜索 狼人:
    艾伟_转载:总结字符串比较函数 狼人:
    poj 2739 Sum of Consecutive Prime Numbers
    BBIT工作感想(二)
    Zenoss4.2.3对中文事件的部分支持修改
    第五周项目一(扩展)矩形类
  • 原文地址:https://www.cnblogs.com/lianshan/p/11508672.html
Copyright © 2020-2023  润新知