Issue/bugs with High Level Rest Client

Hi There,
I am new to Elasticsearch and this forum as well, I am facing a strange issue with my hello world example with Elasticsearch High level Rest API Java Client.
this might be an issue with the API or I may not be setting it correctly.

I am getting below error Message:

Exception in thread "main" ElasticsearchStatusException[Elasticsearch exception [type=parsing_exception, reason=[match] query does not support [auto_generate_synonyms_phrase_query]]]

Suppressed: org.elasticsearch.client.ResponseException: method [GET], host [http://eqtpsfqa15.nam.nsroot.net:9200], URI [/_search?typed_keys=true&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&search_type=query_then_fetch&batched_reduce_size=512], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":215}],"type":"parsing_exception","reason":"[match] query does not support [auto_generate_synonyms_phrase_query]","line":1,"col":215},"status":400}

Here is my code. (please bare with me, its Kotlin)

fun main(args: Array<String>) {
    val restClient = RestHighLevelClient(RestClient.builder(HttpHost("my hostname here ", 9200, "http")))
    val searchRequest: SearchRequest = SearchRequest()
    searchRequest.source(SearchSourceBuilder().query(MatchQueryBuilder("message", "string to be searhed in message")))
    val searchResponse = restClient.search(searchRequest)
    val searchHits = searchResponse.hits.getHits()
    for (hit in searchHits) {
        println(hit.sourceAsString)
    }

}

I have tested connection and other this it works if I am replacing MatchQueryBuilder to MatchAllQueryBuilder
searchRequest.source(SearchSourceBuilder().query(MatchAllQueryBuilder()))

I think you are using a Rest Client 6.1 on a cluster running 5.x or something like this...

Hi David,
thanks for the reply, yes that was the issue and I have moved back to older rest client API and it is working now,
but since I am new I am looking forward for some more help, may be i am not able to find the right examples in the documentation.

I purpose is to use this API for log searching, using mutiple data combination. with AND , OR, and NOT condition for the given Beat name/ hostname
I also want to use timestamp condition with grater then or less then.

with the above example I am only able to find messages with single key.

searchRequest.source(SearchSourceBuilder().query(MatchQueryBuilder("message", "string to be searhed in message")))

Can you please suggest

That's another question. Please open another thread.

Better to first start with just Kibana dev console then when ok move to java code.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.