Min, max dates not formatting?


(Tim Uckun) #1

I have a search like this

{
size: 0,
query: {
match_all: {}
},
aggregations: {

    min_date: {min: {field: 'time_stamp', format: 'date_time'}},
    max_date: {max: {field: 'time_stamp', format: "yyyy-MM-dd HH:mm"}}

}

}

This fails with a parse error. I can only seem to run this query without a
format and I get a unix timestamp. What can I do to get the timestamp
formatted properly.

Thanks.

--
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/CAGuHJrN8ZFNF4aN-qSUawR0m26r3q%2BvLdSAAaYCdeZepzfnTGw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Alexander Reelsen) #2

Hey,

can you try to use date formats instead of the named identificators like
date_time and see if it works? Also, can you check the exception of the
elasticsearch logs?

--Alex

On Wed, Apr 9, 2014 at 4:22 AM, Tim Uckun timuckun@gmail.com wrote:

I have a search like this

{
size: 0,
query: {
match_all: {}
},
aggregations: {

    min_date: {min: {field: 'time_stamp', format: 'date_time'}},
    max_date: {max: {field: 'time_stamp', format: "yyyy-MM-dd HH:mm"}}

}

}

This fails with a parse error. I can only seem to run this query without a
format and I get a unix timestamp. What can I do to get the timestamp
formatted properly.

Thanks.

--
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/CAGuHJrN8ZFNF4aN-qSUawR0m26r3q%2BvLdSAAaYCdeZepzfnTGw%40mail.gmail.comhttps://groups.google.com/d/msgid/elasticsearch/CAGuHJrN8ZFNF4aN-qSUawR0m26r3q%2BvLdSAAaYCdeZepzfnTGw%40mail.gmail.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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9f7BV9qD0b1A4B2Nfe9b9GmV5mDoZ%3DkFHdQ7qQfCyTEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Tim Uckun) #3

On Wednesday, April 9, 2014 7:49:13 PM UTC+12, Alexander Reelsen wrote:

Hey,

can you try to use date formats instead of the named identificators like
date_time and see if it works? Also, can you check the exception of the
elasticsearch logs?

I tried the "yyyy-MM-dd .." it gives an exception and doesn't seem to like
the key "format"

ailed to execute [org.elasticsearch.action.search.SearchRequest@2c5fbec]
lastShard [true]
org.elasticsearch.search.SearchParseException: [blah][0]: from[-1],size[0]:
Parse Failure [Failed to parse source
[{"size":0,"aggregations":{"min_date":{"min":{"field":"time_stamp","format":"HH:mm"}},"max_date":{"max":{"field":"time_stamp"}}}}]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:634)
at
org.elasticsearch.search.SearchService.createContext(SearchService.java:507)
at
org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:480)
at
org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:252)
at
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:202)
at
org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:216)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:203)
at
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:186)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.elasticsearch.search.SearchParseException: [blah][0]:
from[-1],size[0]: Parse Failure [Unknown key for a VALUE_STRING in
[min_date]: [format].]
at
org.elasticsearch.search.aggregations.metrics.ValuesSourceMetricsAggregatorParser.parse(ValuesSourceMetricsAggregatorParser.java:68)
at
org.elasticsearch.search.aggregations.AggregatorParsers.parseAggregators(AggregatorParsers.java:114)
at
org.elasticsearch.search.aggregations.AggregatorParsers.parseAggregators(AggregatorParsers.java:77)
at
org.elasticsearch.search.aggregations.AggregationParseElement.parse(AggregationParseElement.java:60)
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:622)
... 11 more

--
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/494f3834-477e-43ce-9ba5-62f51cfcc97b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4