# How can i fetch all the records which matches by searching some text of all the fields for specific index using java api?

**URL:** <https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618>\
**Category:** Elasticsearch\
**Created:** [November 6, 2014, 9:57pm UTC](https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618 "2014-11-06T21:57:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subbarao\_Kondragunta](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Subbarao\_Kondragunta](https://discuss.elastic.co/u/Subbarao_Kondragunta)\
**Post date:** [November 6, 2014, 9:57pm UTC](https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618/1 "2014-11-06T21:57:00Z")

</div>

How can i fetch all the records which matches by searching some text of all  
the fields for specific index using java api?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ee99bb2e-eb09-4f9e-a05f-8f7c472c728d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ee99bb2e-eb09-4f9e-a05f-8f7c472c728d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pankaj\_Kumar](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@Pankaj\_Kumar](https://discuss.elastic.co/u/Pankaj_Kumar)\
**Post date:** [November 7, 2014, 12:22pm UTC](https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618/2 "2014-11-07T12:22:57Z")

</div>

ES does not return all the records by default, you will have to pass  
thepage size in request. Other way to do this to use count query first the  
pass the size in 2nd query.  
I tried with passing size as Max integer but some time it started going OOM  
because Lucene allocates memory to size passed in request.

Best way is to count first then pass the size in 2nd query.

On Friday, 7 November 2014 03:27:00 UTC+5:30, Subbarao Kondragunta wrote:

> How can i fetch all the records which matches by searching some text of  
> all the fields for specific index using java api?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/47aed74f-c5c9-4cdf-a7b0-0e7a68043d57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/47aed74f-c5c9-4cdf-a7b0-0e7a68043d57%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 7, 2014, 1:37pm UTC](https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618/3 "2014-11-07T13:37:42Z")

</div>

I'd prefer using scroll API.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 7 nov. 2014 à 13:22, Pankaj Kumar [pankajmail@gmail.com](mailto:pankajmail@gmail.com) a écrit :
> 
> ES does not return all the records by default, you will have to pass thepage size in request. Other way to do this to use count query first the pass the size in 2nd query.  
> I tried with passing size as Max integer but some time it started going OOM because Lucene allocates memory to size passed in request.
> 
> Best way is to count first then pass the size in 2nd query.
> 
> > On Friday, 7 November 2014 03:27:00 UTC+5:30, Subbarao Kondragunta wrote:  
> > How can i fetch all the records which matches by searching some text of all the fields for specific index using java api?
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/47aed74f-c5c9-4cdf-a7b0-0e7a68043d57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/47aed74f-c5c9-4cdf-a7b0-0e7a68043d57%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/913BBD70-0153-4479-AA8F-667C4F47EF22%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/913BBD70-0153-4479-AA8F-667C4F47EF22%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:51am UTC](https://discuss.elastic.co/t/how-can-i-fetch-all-the-records-which-matches-by-searching-some-text-of-all-the-fields-for-specific-index-using-java-api/20618/4 "2017-07-06T00:51:29Z")

</div>

Closed on July 6, 2017, 12:51am UTC


