Hi,
In an application I need to get the date and the Product, For
date alone I can get as
Eg
HOUR TOTAL
9 70
11 2
14 4
I can get this by DateHistogram Facet by setting the interval as
hour
"createddaterange" : {
"_type" : "date_histogram",
"entries" : [ {
"time" : 1335430800000,
"count" : 70,
"min" : 1.3354308E12,
"max" : 1.335434149E12,
"total" : 9.34803365E13,
"total_count" : 70,
"mean" : 1.3354333785714285E12
}, {
"time" : 1335438000000,
"count" : 2,
"min" : 1.335440393E12,
"max" : 1.33544091E12,
"total" : 2.670881303E12,
"total_count" : 2,
"mean" : 1.3354406515E12
}, {
"time" : 1335448800000,
"count" : 4,
"min" : 1.3354503E12,
"max" : 1.335450981E12,
"total" : 5.341802376E12,
"total_count" : 4,
"mean" : 1.335450594E12
} ]
For Date as well as the Product_D like
HOUR TOTAL PRODUCT_ID
9 70 11
11 2 34
14 4 22
How can I get this for hour, month, day, week with the Product_ID in
Elasticsearch?
Cheers!
George
On Apr 26, 12:21 pm, George Viju vijuit...@gmail.com wrote:
Thank You David Pilato!
Cheers!
George
On Apr 26, 12:16 pm, David Pilato da...@pilato.fr wrote:
You could create a new field which add product and sale with a separator and with no analyzer.
Then compute the facet on that new field.
David
Twitter : @dadoonet / @elasticsearchfr
Le 26 avr. 2012 à 08:09, George Viju vijuit...@gmail.com a écrit :
Hi,
In my application
Product_ID Total Sale_ID
3 2 1
4 5 3
9 3 4
It means, For the Two Fields Product_ID and Sale_ID I need the
Total Count.
Here I need to get the Total Which should satisfies both Product_Id
and Sale_ID
The Expected output is like
"itemcount" : {
{
"term1" : "3",
"term2" : "1",
"count" : 2
}, {
"term1" : "4",
"term2" : "3"
"count" : 5
}, {
"term1" : "9",
"term2" : "4",
"count" : 3
},
}
How can I get this using Elasticsearch?
Cheers!
George