Skip to content
Advertisement

Elastic API doesn’t show all documents

i have elastic that i want to fetch the data from elastic with query, i have about 210 documents in the index, but when i tried to search with query match_all, the api only showing 7 documents and not all documents, is it possible to api showing all documents instead only show some documents.

The query :

JavaScript

The elastic API result :

JavaScript

Advertisement

Answer

It returns 10 results (not 7). This is because you didn’t specify a size.

From the docs:

By default, searches return the top 10 matching hits. To page through a larger set of results, you can use the search API’s from and size parameters. The from parameter defines the number of hits to skip, defaulting to 0. The size parameter is the maximum number of hits to return. Together, these two parameters define a page of results.

So, this is how your query would look with the maximum size of 10,000:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement