Can TopHits Size set to maximum using Java API..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Can TopHits Size set to maximum using Java API..

Anusha
Hi ,

I would like to retrieve the tophits key all documents. Where we can retrieve all the keys by keeping the size :0 in terms query. But I would like to retrieve all documents for a key.

The Query am using:


GET filter_parts/filter_parts_type/_search
{
   "size": 0,
   "query": {
   "bool": {
       "must": [
          {
              "match": {
                 "PROPERTY1.@key": "Dispensing Type"
              }
          },
          {
              "match": {
                 "PROPERTY1.@value": "Pour"
              }
          }
       ]
   }
   },
    "aggs":
    {
        "value_Agg":
        {
            "terms":
            {
                "field":"PROPERTY1.@value",
                "size":0
            },
            "aggs":
            {
                "top":
                {
                    "top_hits":
                    {
                        "size":5
                    }
                }
            }
        }
    }
   
}


So with the key "POUR" the total number of documents count "doc_count": 1477, But as I set size of tophits to 5 am able to retrieve only 5 documents How to set the size to Maximum or how to get all the records of that key..

Am using Java API to that is:

        SearchResponse response = srb.addAggregation(AggregationBuilders.terms("value_Agg").field("PROPERTY1.@value").size(0).
                subAggregation(AggregationBuilders.topHits("top").setSize(5))).execute().actionGet();
 
So how to set maximum size for topHits...?????????

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/
---
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c2cf15c9-91bb-48d9-8791-a572c85ff8dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.