Unable to set query parameters (like `filter_path`) in search requests
See original GitHub issueDescription
In the RHLC, which this client is meant to replace, you can make a call like:
restHighLevelClient.search(searchRequest, requestOptions);
It is possible to customise requestOptions such that a query param is added to REST requests going to Elasticsearch, e.g.
RequestOptions requestOptions = RequestOptions.DEFAULT.toBuilder()
.addParameter("filter_path", "-hits.hits._source.annotations")
.build();
This feature was added by https://github.com/elastic/elasticsearch/pull/67802 and its respective back ports.
In the new Java client, you make a call like:
esClient.search(searchRequest, MyDocument.class)
I have not been able to find any way to customise the SearchRequest
to set a parameter like filter_path
. Please would you advise me how to do this; and if it’s not currently possible, then please treat this as a feature request! It would be unfortunate to be blocked from upgrading to the new Java client, and thereby blocked from upgrading our applications beyond Java 8, simply because the new Java client is less capable than the existing RHLC.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
Top GitHub Comments
Sounds like we don’t have much choice but to upgrade in due course! Hopefully you will then fix the blocking issues which make the new client unusable in some cases, e.g.:
Otherwise we’re somewhat stuck.
For the HLRC split package issue, have you tried the solutions I suggested? We can also add to this list using the shade plugin to build a fat jar.