Elasticsearch returns only 10 records but the hit is 507


(Vishnu P S) #1

I am using invenio_search to search data from elasticsearch. I am able to query the elasticsearch and the results shows hits greater than 500. But receiving only 10 records. Is there any way to change the configuration so that to get entire records from elasticsearch.


#2

By default Elastic returns 10 documents! if you want to increase the number of documents, add the size parameter in your query.

https://www.elastic.co/guide/en/elasticsearch/reference/6.3/search-request-from-size.html


(Vishnu P S) #3

Thanks for the suggestion. I faced this issue in invenio search and I found the solution and is given below.

search = RecordsSearch()
search = search.query(QueryString(query='mi'))
count = search.count()
results = search[0:count].execute().to_dict()


(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.