Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to retrieve all records in a (ElasticSearch) NEST query? [duplicate]

I'm doing this query in NEST

var result = elasticClient.Search<SearchItemClass>( s=>
    s.Index("indexName")
     .Type("typeName")
     .Query(q => q.ConstantScore(score => score.Filter(f => f.Term("fieldName", "term"))))
);

And this will return 10 Hits by default.

Is there a way I can get ALL results, WITHOUT indicating .Size(value) or .Take(value)?

Thanks in advance!

like image 577
jac Avatar asked Jan 15 '15 01:01

jac


People also ask

How do I get all records in Elasticsearch?

Introduction. You can use cURL in a UNIX terminal or Windows command prompt, the Kibana Console UI, or any one of the various low-level clients available to make an API call to get all of the documents in an Elasticsearch index. All of these methods use a variation of the GET request to search the index.

How do I retrieve more than 10000 results events in Elasticsearch?

By default, you cannot use from and size to page through more than 10,000 hits. This limit is a safeguard set by the index. max_result_window index setting. If you need to page through more than 10,000 hits, use the search_after parameter instead.

How do I retrieve data from Elasticsearch?

You can use the search API to search and aggregate data stored in Elasticsearch data streams or indices. The API's query request body parameter accepts queries written in Query DSL. The following request searches my-index-000001 using a match query. This query matches documents with a user.id value of kimchy .

Why is Elasticsearch not returning all results?

The reason might be that you haven't provided the size parameter in the query. This limits the result count to 10 by default. Out of all the results the top 10 might be from the two index even thought the match is present in third index as well.


1 Answers

This is a dup of Elasticsearch query to return all records. To use scan and scroll, look at the NEST documentation here.

like image 157
bittusarkar Avatar answered Oct 09 '22 08:10

bittusarkar