I have an index /testdate/daterange with the following mapping
PUT /testdate/daterange/_mapping
{
"daterange": {
"properties": {
"text":{
"type": "string"
},
"date": {
"type": "date",
"format": "dateOptionalTime"
}
}
}
}
And there are some documents e.g
PUT /testdate/daterange/1
{
"text": "This Quater",
"date": "2015-01-20T07:22:15+00:00"
}
PUT /testdate/daterange/2
{
"text": "Last Quater",
"date": "2015-11-20T07:22:15+00:00"
}
I want to search using a filter on the date field for documents from this
the last quarter. Something like the following
GET /testdate/daterange/_search
{
"filter":{
"range": {
"date": {
"gt": "now-1Q/Q",
"lt": "now/Q"
}
}
}
}
Elasticsearch only supports Joda date formats
(http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html)
which does not have any support for quarter.
Also if I try something like
GET /testdate/daterange/_search
{
"filter":{
"range": {
"date": {
"gt": "now-3M/3M",
"lt": "now/3M"
}
}
}
}
I get an error
ElasticsearchParseException[rounding `/` can only be used on single
unit types
So how can I achieve this?
--
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/2208cf81-1553-4115-866d-65f782433759%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.