1

I have indexed documents with this simplified structure:

public class Document
{
    public string Id { get; set; }
    public string x { get; set; }

}

I am searching them like this:

var initialResponse = client.Search<Document>(s => s.From(0)
    .Size(100).Scroll(scrollTimeout)
    .Query(q => q
        .MatchPhrase(c => c
            .Field(p => p.Attachment.Content)
            .Analyzer("standard")
            .Boost(1.1)
            .Query(searchTerm)
        ))); 

and then loop over the documents (more code here). This obviously take time and I wonder, if I could obtain all Ids or even better x values of the matched documents in one payload?

Thanks!

1 Answer 1

1

Elasticsearch has a index.max_result_window setting with a default value of 10,000.

That's the max number of documents you can retrieve in a single request. If you want to get more than that - you'll need to use scroll or search_after API, as you do already.

Sign up to request clarification or add additional context in comments.

4 Comments

thanks. however, can one aggregate server side and just get the aggregated payload?
@cs0815 I believe you cannot do it. You'll have to do it on your client-side.
Thanks. wow, somehow I do not see the point of ES then. Let us say I just want the number of document containing a (fuzzy) term?
In that case, you could issue a count query and it would tell you the exact number of documents it found with that term. As for not seeing point for ES, ES being a search engine is optimized to return top-k documents, hence the limit :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.