# Multi search API: Getting more than 500 hits

**URL:** https://discuss.elastic.co/t/multi-search-api-getting-more-than-500-hits/245752
**Category:** Elasticsearch
**Created:** [August 20, 2020, 10:51am UTC](https://discuss.elastic.co/t/multi-search-api-getting-more-than-500-hits/245752 "2020-08-20T10:51:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MartaB](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@MartaB](https://discuss.elastic.co/u/MartaB)
#### Post date: [August 20, 2020, 10:51am UTC](https://discuss.elastic.co/t/multi-search-api-getting-more-than-500-hits/245752/1 "2020-08-20T10:51:06Z")

</div>

Hello guys!

I kindly need your help with something.

I'm building a script using groovy. The main goal is to retrieve all the logs we have on our server so I can use that logs, apply some logic (e.g., regex, conditional logic) and retrieve the results on a csv.

The thing is: in most cases when I try to use the Multi-search API, I only get 500 hits. On most case, the number is way larger than then (20k, for example).

I know that it's not possible to use a scroll mechanism on this API, but it's the only one I have access to (the platform in which we have our API's - Mulesoft -, only exposes the _\_msearch_ endpoint; it's impossible to use another one).

I can't really work only with 500 hits.  
My goal is to use Groovy/Java to make this happen and I can't come up with a solution.

Do you guys have any idea of how I can achieve this result to retrieve all the information? Some kind of logic that allows us me to say to the API: Ok, find me the first 500, then go ahead and retrive the next 500, and so on.

Thank you!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 17, 2020, 10:51am UTC](https://discuss.elastic.co/t/multi-search-api-getting-more-than-500-hits/245752/2 "2020-09-17T10:51:10Z")

</div>

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