sujoysett  
                (sujoysett)
               
                 
              
                  
                    September 25, 2012,  6:23am
                   
                   
              1 
               
             
            
              I often use terms facet script to do grouping on multiple fields, as 
following:
{ 
"facets": { 
"my_terms_facet": { 
"terms ": { 
"size": 5, 
"script ": "doc['field1'].value + "~" + 
doc['field2'].value + " ~" +  doc['field3'].value" 
} 
} 
} 
}
The result is parsed on the response using client side scripts for 
necessary display formatting.
The above query gives only the count, whereas now I am looking for summing 
up based on a fourth field.
Is something possible on combining script and terms-stats facet? Something 
like following?
{ 
"facets": { 
"my_terms_stats_facet": { 
"terms_stats ": { 
"size": 5, 
"key_script ": "doc['field1'].value + "~" + 
doc['field2'].value + " ~" +  doc['field3'].value", 
"value_field": "field4" 
} 
} 
} 
}
Thanks in advance,
--
             
            
               
               
               
            
            
           
          
            
              
                sujoysett  
                (sujoysett)
               
              
                  
                    October 1, 2012,  5:20am
                   
                   
              2 
               
             
            
              Hi,
Any hint/hope on the following?
Thanks,
On Tuesday, September 25, 2012 11:53:12 AM UTC+5:30, Sujoy Sett wrote:
I often use terms facet script to do grouping on multiple fields, as 
following:
{ 
"facets": { 
"my_terms_facet": { 
"terms ": { 
"size": 5, 
"script ": "doc['field1'].value + "~" + 
doc['field2'].value + " ~" +  doc['field3'].value" 
} 
} 
} 
}
The result is parsed on the response using client side scripts for 
necessary display formatting.
The above query gives only the count, whereas now I am looking for summing 
up based on a fourth field.
Is something possible on combining script and terms-stats facet? Something 
like following?
{ 
"facets": { 
"my_terms_stats_facet": { 
"terms_stats ": { 
"size": 5, 
"key_script ": "doc['field1'].value + "~" + 
doc['field2'].value + " ~" +  doc['field3'].value", 
"value_field": "field4" 
} 
} 
} 
}
Thanks in advance,
 
--