Skip to content

Search query with Size(0) #1151

@PoOoZaQ

Description

@PoOoZaQ

I am using Search to get docs according to some query.
What I would expect Size(0) to do is just return all the documents that answer the query.
Instead it returns the full object with 0 results, forcing me to execute the same query again with the number of "to-be" results.
Here is the code I wrote:

var resultsCount = _client.Search<JObject>(s => s.Query(q => q.Terms("string.ProgramId", ids))
            .Size(0));

var results = _client.Search<JObject>(s => s.Query(q => q.Terms("string.ProgramId", ids))
            .Size((int)resultsCount.Total));

Here is what I get in the first line:
nest_size0

Am I doing something wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions