Skip to content

Allow specifying max results in NativeSearchQueryBuilder [DATAES-988] #1561

Closed
@spring-projects-issues

Description

@spring-projects-issues

Patrick Strawderman opened DATAES-988 and commented

It would be useful to have a "withMaxResults" method to NativeSearchQueryBuilder for specifying the maxResults on the built Query. This is common for aggregation queries where search hits are not needed.

Having the builder method for setting maxResults is a minor ergonomic improvement, e.g.

NativeSearchQuery searchQuery = NativeSearchQueryBuilder()
    .withQuery(matchAllQuery())
    .addAggregation(terms("examples").field("example"))
    .withMaxResults(0)
    .build();

versus what is required now:

NativeSearchQuery searchQuery = NativeSearchQueryBuilder()
    .withQuery(matchAllQuery())
    .addAggregation(terms("examples").field("example"))
    .build();
searchQuery.setMaxResults(0);


Referenced from: pull request #561

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions