Skip to content

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

@oliverlockwood

Description

@oliverlockwood

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 elastic/elasticsearch#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: QuestionNot an issue but a question. May lead to enhancing docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions