Minimum and Maximum date in Elasticsearch

On Tue, Apr 17, 2012 at 20:53, George Viju vijuitech@gmail.com wrote:

Is there any method to make the week to start from Sunday and

ends at Saturday? How to use postOffset() method with DateHistogram
Facet?

How about like so?

DateHistogramFacetBuilder facet = ...
TimeValue oneDayEarlier = TimeValue.timeValueHours(-24);
facet.preOffset(oneDayEarlier).postOffset(oneDayEarlier);

Thank you Eric Jain!

I tried using the code for the date April 1(Sunday) to 13(Friday)
but again I am getting 3 week as count

"createddaterange" : {
"_type" : "date_histogram",
"entries" : [ {
"time" : 1332633600000,
"count" : 30,
"min" : 1.3332708E12,
"max" : 1.3333572E12,
"total" : 3.999942E13,
"total_count" : 30,
"mean" : 1.333314E12
}, {
"time" : 1333238400000,
"count" : 113,
"min" : 1.3334436E12,
"max" : 1.333967978E12,
"total" : 1.50710536311E14,
"total_count" : 113,
"mean" : 1.3337215602743362E12
}, {
"time" : 1333843200000,
"count" : 62,
"min" : 1.3340484E12,
"max" : 1.3343076E12,
"total" : 8.2718964797E13,
"total_count" : 62,
"mean" : 1.334176851564516E12
} ]
}

The Facet is

"createddaterange" : {
"date_histogram" : {
"key_field" : "createddate",
"value_field" : "createddate",
"interval" : "week",
"pre_offset" : -86400000,
"post_offset" : -86400000
}
}

Cheers!

George

On Apr 18, 9:57 am, Eric Jain eric.j...@gmail.com wrote:

On Tue, Apr 17, 2012 at 20:53, George Viju vijuit...@gmail.com wrote:

Is there any method to make the week to start from Sunday and

ends at Saturday? How to use postOffset() method with DateHistogram
Facet?

How about like so?

DateHistogramFacetBuilder facet = ...
TimeValue oneDayEarlier = TimeValue.timeValueHours(-24);
facet.preOffset(oneDayEarlier).postOffset(oneDayEarlier);

Settings the offsets should work, what do you mean by 3 weeks?

On Wed, Apr 18, 2012 at 9:16 AM, George Viju vijuitech@gmail.com wrote:

Thank you Eric Jain!

I tried using the code for the date April 1(Sunday) to 13(Friday)
but again I am getting 3 week as count

"createddaterange" : {
"_type" : "date_histogram",
"entries" : [ {
"time" : 1332633600000,
"count" : 30,
"min" : 1.3332708E12,
"max" : 1.3333572E12,
"total" : 3.999942E13,
"total_count" : 30,
"mean" : 1.333314E12
}, {
"time" : 1333238400000,
"count" : 113,
"min" : 1.3334436E12,
"max" : 1.333967978E12,
"total" : 1.50710536311E14,
"total_count" : 113,
"mean" : 1.3337215602743362E12
}, {
"time" : 1333843200000,
"count" : 62,
"min" : 1.3340484E12,
"max" : 1.3343076E12,
"total" : 8.2718964797E13,
"total_count" : 62,
"mean" : 1.334176851564516E12
} ]
}

The Facet is

"createddaterange" : {
"date_histogram" : {
"key_field" : "createddate",
"value_field" : "createddate",
"interval" : "week",
"pre_offset" : -86400000,
"post_offset" : -86400000
}
}

Cheers!

George

On Apr 18, 9:57 am, Eric Jain eric.j...@gmail.com wrote:

On Tue, Apr 17, 2012 at 20:53, George Viju vijuit...@gmail.com wrote:

Is there any method to make the week to start from Sunday and

ends at Saturday? How to use postOffset() method with DateHistogram
Facet?

How about like so?

DateHistogramFacetBuilder facet = ...
TimeValue oneDayEarlier = TimeValue.timeValueHours(-24);
facet.preOffset(oneDayEarlier).postOffset(oneDayEarlier);

It means

April 1(Sunday) -- April 7(Saturday) 1 Week

April 8(Sunday) -- April 13(Friday) `1 week

This is the actual count of week here..But it is taking as

3 weeks and showing 3 min max values and 3 counts for 3 weeks

Cheers!

George

On Apr 19, 7:33 pm, Shay Banon kim...@gmail.com wrote:

Settings the offsets should work, what do you mean by 3 weeks?

On Wed, Apr 18, 2012 at 9:16 AM, George Viju vijuit...@gmail.com wrote:

Thank you Eric Jain!

I tried using the code for the date April 1(Sunday) to 13(Friday)
but again I am getting 3 week as count

"createddaterange" : {
"_type" : "date_histogram",
"entries" : [ {
"time" : 1332633600000,
"count" : 30,
"min" : 1.3332708E12,
"max" : 1.3333572E12,
"total" : 3.999942E13,
"total_count" : 30,
"mean" : 1.333314E12
}, {
"time" : 1333238400000,
"count" : 113,
"min" : 1.3334436E12,
"max" : 1.333967978E12,
"total" : 1.50710536311E14,
"total_count" : 113,
"mean" : 1.3337215602743362E12
}, {
"time" : 1333843200000,
"count" : 62,
"min" : 1.3340484E12,
"max" : 1.3343076E12,
"total" : 8.2718964797E13,
"total_count" : 62,
"mean" : 1.334176851564516E12
} ]
}

The Facet is

"createddaterange" : {
"date_histogram" : {
"key_field" : "createddate",
"value_field" : "createddate",
"interval" : "week",
"pre_offset" : -86400000,
"post_offset" : -86400000
}
}

Cheers!

George

On Apr 18, 9:57 am, Eric Jain eric.j...@gmail.com wrote:

On Tue, Apr 17, 2012 at 20:53, George Viju vijuit...@gmail.com wrote:

Is there any method to make the week to start from Sunday and

ends at Saturday? How to use postOffset() method with DateHistogram
Facet?

How about like so?

DateHistogramFacetBuilder facet = ...
TimeValue oneDayEarlier = TimeValue.timeValueHours(-24);
facet.preOffset(oneDayEarlier).postOffset(oneDayEarlier);