rubyprince  
                (rubyprince)
               
                 
              
                  
                    December 20, 2013,  5:36am
                   
                   
              1 
               
             
            
              Facets is very useful to get the count of the items, as a whole.
But my problem is, I want the count for the query, I am searching inside 
the size limit I am specifying. Look at the query, I am making:
curl -X GET 
'http://localhost:9200/posts/post/_search?from=0&size=10&pretty ' -d '{ 
"query": { 
"filtered": { 
"query": { 
"query_string": { 
"query": "exists :country AND content:(obama OR somalia)" 
} 
} 
} 
}, 
"facets": { 
"content": { 
"terms": { 
"field": "content", 
"size": 10, 
"all_terms": false, 
"regex": "obama|somalia", 
"regex_flags": [ 
"DOTALL", 
"CASE_INSENSITIVE" 
] 
} 
} 
}, 
"size": 10000, 
"fields": [ 
"continent", 
"country", 
"id", 
"location", 
"sentiment", 
"tweet_created_at" 
], 
"version": true 
}'
This is the query, I am using now. But the facet content is giving count 
for the database as a whole satisfying the query string. But, I want to 
facet within the 10,000 returned.
Is there a way to facet like that?
-- 
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 . 
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f5c1ccbb-3b01-492e-9357-37f14ea5e587%40googlegroups.com . 
For more options, visit https://groups.google.com/groups/opt_out .
             
            
               
               
               
            
            
           
          
            
              
                Ivan  
                (Ivan Brusic)
               
              
                  
                    December 20, 2013,  5:11pm
                   
                   
              2 
               
             
            
              The facet will work on all the documents that satisfy the query. The size 
parameter in the query only denotes how many documents that match the query 
should be returned.
There is an issue regarding faceting only on the top n results:
  
  
    
  
  
    
    
      
        opened 06:50PM - 21 Jun 12 UTC 
      
        
          closed 02:29PM - 12 May 15 UTC 
        
      
     
    
        
          >feature
         
    
   
 
  
    See
https://groups.google.com/d/msg/elasticsearch/OZsc5ofNhag/9JfwSy-CEMwJ where…  Shay says "...with the design of the facets, if shouldn't be hard to implement..." 
   
   
  
    
    
  
  
 
Cheers,
Ivan
On Thu, Dec 19, 2013 at 9:36 PM, Prince princejcet@gmail.com  wrote:
Facets is very useful to get the count of the items, as a whole.
But my problem is, I want the count for the query, I am searching inside 
the size limit I am specifying. Look at the query, I am making:
curl -X GET ' 
http://localhost:9200/posts/post/_search?from=0&size=10&pretty ' -d '{ 
"query": { 
"filtered": { 
"query": { 
"query_string": { 
"query": "exists :country AND content:(obama OR somalia)" 
} 
} 
} 
}, 
"facets": { 
"content": { 
"terms": { 
"field": "content", 
"size": 10, 
"all_terms": false, 
"regex": "obama|somalia", 
"regex_flags": [ 
"DOTALL", 
"CASE_INSENSITIVE" 
] 
} 
} 
}, 
"size": 10000, 
"fields": [ 
"continent", 
"country", 
"id", 
"location", 
"sentiment", 
"tweet_created_at" 
], 
"version": true 
}'
This is the query, I am using now. But the facet content is giving count 
for the database as a whole satisfying the query string. But, I want to 
facet within the 10,000 returned.
Is there a way to facet like that?
-- 
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 . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/f5c1ccbb-3b01-492e-9357-37f14ea5e587%40googlegroups.com  
. 
For more options, visit https://groups.google.com/groups/opt_out .
 
-- 
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 . 
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAjOkXAEvG8CwhjSRKYbxSmzaJ5QAzvcmDOPGe-fjW2NQ%40mail.gmail.com . 
For more options, visit https://groups.google.com/groups/opt_out .