Specify search analyzer during query time with the new Elastic Java Client

Hi, is there a way to specify which analyzer to use for the query string while querying the index via the Elasticsearch Java Client API?

I'm using the new Java Client API and when I'm specifying the analyzer during search time, I'm getting the following error:

co.elastic.clients.elasticsearch._types.ElasticsearchException: [es/search] failed: [illegal_argument_exception] request [/test-index/_search] contains parameters [analyzer] but missing query string parameter 'q'.
   at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:281) ~[elasticsearch-java-8.3.1.jar:na]
   at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:147) ~[elasticsearch-java-8.3.1.jar:na]
   at co.elastic.clients.elasticsearch.ElasticsearchClient.search(ElasticsearchClient.java:1502) ~[elasticsearch-java-8.3.1.jar:na]
   at com.bse.bserpv2.service.ItemSummaryService.searchItemSummaryCrossFields(ItemSummaryService.java:57) ~[classes/:na]

If I remove the analyzer, or mention queryString the result returns with zero hit for my second use case.

For more details please see my detailed question here

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