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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With