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

**URL:** https://discuss.elastic.co/t/specify-search-analyzer-during-query-time-with-the-new-elastic-java-client/309235
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [July 8, 2022, 10:58pm UTC](https://discuss.elastic.co/t/specify-search-analyzer-during-query-time-with-the-new-elastic-java-client/309235 "2022-07-08T22:58:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Karan\_Bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karan_bansal/32/108106_2.png) [@Karan\_Bansal](https://discuss.elastic.co/u/Karan_Bansal)
#### Post date: [July 8, 2022, 10:58pm UTC](https://discuss.elastic.co/t/specify-search-analyzer-during-query-time-with-the-new-elastic-java-client/309235/1 "2022-07-08T22:58:58Z")

</div>

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:

```auto
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

> <https://stackoverflow.com/questions/72917582/how-to-implement-space-ignored-search-across-a-document-with-multiple-fields-in>

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [August 5, 2022, 10:59pm UTC](https://discuss.elastic.co/t/specify-search-analyzer-during-query-time-with-the-new-elastic-java-client/309235/2 "2022-08-05T22:59:11Z")

</div>

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