question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set query parameters (like `filter_path`) in search requests

See original GitHub issue

Description

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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
oliverlockwoodcommented, Mar 21, 2022

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.

0reactions
swallezcommented, May 4, 2022

we don’t have much choice but to upgrade in due course

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter_path support in Java Client - Elastic Discuss
Please see Unable to set query parameters (like `filter_path`) in search requests · Issue #203 · elastic/elasticsearch-java · GitHub to see ...
Read more >
Unable to set query parameters manually for a rest api (using ...
The problem is that r.URL.Query() parses the url, creates the map of parameters and returns it. This is done with every .Query() call....
Read more >
OData Version 4.01. Part 2: URL Conventions - OASIS Open
Example 10: function with parameters as query options ... applying any /$filter path segments, or $filter or $search system query options to the...
Read more >
Create a parameter query (Power Query) - Microsoft Support
Parameters are saved in a simple parameter query, but are separate from the data queries they are used in. Once created, you can...
Read more >
Query Parameters - Redash
Any string between double curly braces {{ }} will be treated like a parameter. A widget will appear above the results pane so...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found