Thanks! I'm going to try this.


On Thursday, August 28, 2014 1:05:11 PM UTC+2, vineeth mohan wrote:
>
> Hello ,
>
> Aggregation is exactly what you are looking for.
>
> First you need to structure your data in this manner - 
>
> categories : [ 
>
>                       {  "key" : "f2",
>
>                           "value" :  3
>
>                      },
>
>                      { "key" : "f3",
>
>                         "value" : "c"
>
>                       }
>
>                      ]
>
>
> Then simply apply a 2 level aggregation - 
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations.html
>
>
> Thanks
>
>            Vineeth
>
>
>
>
> On Thu, Aug 28, 2014 at 2:51 PM, Krešimir Slugan <[email protected] 
> <javascript:>> wrote:
>
>> I have Elasticsearch cluster with e-shop data. There are many product in 
>> there and they have attributes which belong to attribute categories. When I 
>> search I don't know which attribute category are going to be returned and I 
>> need facet statistic for every one of them. 
>>
>>
>> E.g. documents look like:
>>
>> { 
>>
>> "doc": "doc1",
>>
>>  categories: { "f1": "a", "f2": 0, "f3": "b", } 
>>
>> }, 
>>
>> { 
>>
>> "doc": "doc2", 
>>
>> categories: { "f2": 3, "f3": "c", "f4": "d", }
>>
>> }
>>
>> I need to get facets statistic for every key in categories part of 
>> document e.g. statistic for f1, f2, f3 etc. and I need to get it in one 
>> query (not to get all categories first and then issue second query for 
>> actual data)...It is ok if I have to change data structure. Is it possible 
>> to do this using facets or aggregations in Elasticsearch?
>>  
>> -- 
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/a9ac8ce6-14d0-44dd-9721-a3ba75477aaa%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/a9ac8ce6-14d0-44dd-9721-a3ba75477aaa%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c04d9e13-c0e8-4233-b7e7-61f6663ab134%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to