# setFrom for Facet Search

**URL:** <https://discuss.elastic.co/t/setfrom-for-facet-search/7695>\
**Category:** Elasticsearch\
**Created:** [May 15, 2012, 12:47am UTC](https://discuss.elastic.co/t/setfrom-for-facet-search/7695 "2012-05-15T00:47:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [May 15, 2012, 12:47am UTC](https://discuss.elastic.co/t/setfrom-for-facet-search/7695/1 "2012-05-15T00:47:19Z")

</div>

Hello,  
I have a simple ordered facet search, and it works fine. The result is  
ordered by counts. I can set size of the result, but if I want to get a  
next chunk of the counts, how could I get it?  
Here is my code:

SearchResponse response = clientProvider.getClient()

.prepareSearch(clientProvider.getIndexName())

```
    .addFacet(

    FacetBuilders.termsFacet("myStat")

    .field("myField")

    .order(ComparatorType.COUNT)

    .size(30)

    .facetFilter(FilterBuilders.rangeFilter("sequence")

```

.from(Utils.nextSequence()-1000_60_60\*24)))

```
    .setTypes("myType")

    .execute()

    .actionGet();

```

So, I need something like setFrom() which we have for queries, but I need  
it for facet search, and it doesn't look like we have it.

Could you please help me out here?

Thank you,

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [May 15, 2012, 1:06pm UTC](https://discuss.elastic.co/t/setfrom-for-facet-search/7695/2 "2012-05-15T13:06:01Z")

</div>

I think all you can do at this moment is just retrieve 60 facets and ignore  
first 30.

On Monday, May 14, 2012 8:47:19 PM UTC-4, Eugene Strokin wrote:

> Hello,  
> I have a simple ordered facet search, and it works fine. The result is  
> ordered by counts. I can set size of the result, but if I want to get a  
> next chunk of the counts, how could I get it?  
> Here is my code:
> 
> SearchResponse response = clientProvider.getClient()
> 
> .prepareSearch(clientProvider.getIndexName())
> 
> ```
> .addFacet(
> 
> FacetBuilders.termsFacet("myStat")
> 
> .field("myField")
> 
> .order(ComparatorType.COUNT)
> 
> .size(30)
> 
> .facetFilter(FilterBuilders.rangeFilter("sequence")
> 
> ```
> 
> .from(Utils.nextSequence()-1000_60_60\*24)))
> 
> ```
> .setTypes("myType")
> 
> .execute()
> 
> .actionGet();
> 
> ```
> 
> So, I need something like setFrom() which we have for queries, but I need  
> it for facet search, and it doesn't look like we have it.
> 
> Could you please help me out here?
> 
> 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:** [July 6, 2017, 3:28am UTC](https://discuss.elastic.co/t/setfrom-for-facet-search/7695/3 "2017-07-06T03:28:50Z")

</div>


