elasticsearch异常query does not support [auto_generate_synonyms_phrase_query]

java | 2022-03-04 16:32:13

1.异常

elasticsearch 报错如下:

Caused by: ElasticsearchStatusException[Elasticsearch exception [type=parsing_exception, reason=[multi_match] query does not support [auto_generate_synonyms_phrase_query]]]
        at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:187)
        at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:1892)
        at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1869)
        at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1626)
        at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1583)
        at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1553)
        at org.elasticsearch.client.RestHighLevelClient.search(RestHighLevelClient.java:1069)
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.lambda$search$10(ElasticsearchRestTemplate.java:256)
        at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.execute(ElasticsearchRestTemplate.java:343)
        ... 69 more
        Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://192.168.10.6:9200], URI [/filesearch/_search?typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=dfs_query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[multi_match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":307}],"type":"parsing_exception","reason":"[multi_match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":307},"status":400}
                at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:302)
                at org.elasticsearch.client.RestClient.performRequest(RestClient.java:272)
                at org.elasticsearch.client.RestClient.performRequest(RestClient.java:246)
                at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1613)
                ... 74 more

2.配置

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
        </dependency>

版本是2.4.1

进去

<dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-elasticsearch</artifactId>
      <version>4.1.2</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>transport</artifactId>
          <groupId>org.elasticsearch.client</groupId>
        </exclusion>
      </exclusions>
    </dependency>

 

3.解决方法

把elasticsearch版本改到6

docker run -itd --name es-file-manage --network net-platform --ip 192.168.10.6 -e "discovery.type=single-node" elasticsearch:6.8.22

抛出异常

 contains unrecognized parameter: [ccs_minimize_roundtrips]]]

只好先去查版本对应关系

https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions

所以我需要一个7.9.3版本的 elasticsearch

docker run -itd --name es-file-manage --network net-platform --ip 192.168.10.6 -e "discovery.type=single-node" elasticsearch:7.9.3

 

 

 

登录后即可回复 登录 | 注册
    
相关文章
ehcache异常net.sf.ehcache.cacheexception value is not serializable解决解决spark hive插入数据异常spark currently does not populate bucketed outputspark on yarn 异常 spark shuffle does not existspark hive 异常 could not connect to meta store using any of the uris providedphp ibm db2 函数 returns the auto generated id of the last insert query that successfully executed on this connectionphp maxdb 函数 returns the auto generated id used in the last queryphp sqlite 函数 opens a persistent handle to an sqlite database and create the database if it does not existphp sqlite 函数 execute a query that does not prefetch and buffer all dataphp sybase 函数 send a sybase query and do not blockphp wincache 函数 adds a variable in user cache only if variable does not already exist in the cachephp mongocollection creates an index on the specified field s if it does not already existphp mongocollection creates an index on the specified field s if it does not already existphp mysqlnduhconnection returns the auto generated id used in the last queryphp solrquery returns whether or not the query will be boosted by the interesting term relevancephp solrquery returns the maximum number of tokens to parse in each document field that is not stored with termvector supportphp solrquery whether to highlight phrase terms only when they appear within the query phrasephp splfileobject splfileobject does not have children解决 php 腾讯企业 发送 邮件异常SMTP Error: Could not authenticateelasticsearch异常query does not support [auto_generate_synonyms_phrase_query]
关注编程学问公众号