Parsing_Exception [match] query does not support [auto_generate_synonyms_phrase_query]
Asked Answered
S

1

5

Below given is my code:

SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchQuery("field", "value to search"));
Search search = new Search.Builder(searchSourceBuilder.toString()).build();
JestResult result = jestc.execute(search);

While running this code it gives exception: {"error":{"root_cause":[{"type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":213}],"type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":213},"status":400}

Need help to resolve this issue.... Tried match_all query and it worked. No idea why this is failing.

I am using "org.elasticsearch" and "org.elasticsearch.client" of 6.1.1 version and jest version is 5.3.3. Not sure if it matters.

Thanks in advance

Springe answered 10/1, 2018 at 5:52 Comment(0)
S
20

Found the problem. I was using the 6.1.1 API version, but my elastic nodes were on 5.x which doesn't support the auto_generate_synonyms_phrase_query parameter.

I moved "org.elasticsearch" and "org.elasticsearch.client" to version 5.6.0 and this fixed it for me. There are certain methods such as QueryBuilders.matchQuery(...) in the 6.1.1 client that add the new parameter and hence break backwards compatibility. The elasticsearch nodes where I am performing the query are on 5.x so they don't understand this new parameter.

Springe answered 10/1, 2018 at 6:32 Comment(4)
I ran into this issue when running Elasticsearch version 6.0 (offered by the AWS Elasticsearch Service).. I thought it would be okay to run the latest client (6.1.2), but it turns out I actually needed to use the client version 6.0.0.Hermann
Hi, my java client and AWS elasticsearch version is aligned which is 6.0.1 but I still encounter this error. Have you done something (maybe hack) to fix this one?Mukluk
@Mukluk I can confirm that switching to the 6.0.1 high level java client fixes the problem.Alixaliza
I use the elasticsearch-rest-high-level-client with elasticsearch and switched to version 6.0.0 and I got it working. Version 6.2.3 was in error.Orjonikidze

© 2022 - 2024 — McMap. All rights reserved.