I have some documents in an index. my document look like this:
{
"_index" : "news_collection",
"_type" : "news",
"_id" : "54dafbf0e4b0e3cf93676007",
"_score" : 0.2631625,
"_source":{"title":"some title","content":"example content"
,"publication_date":"Dec 31, 2006 11:11:00 PM"},
{
"_index" : "news_collection",
"_type" : "news",
"_id" : "54dafbf0e4b0e3cf93676007",
"_score" : 0.2631625,
"_source":{"title":"some title","content":"example content"
,"publication_date":"Dec 31, 2006 11:11:00 PM"},
I want to group my document in month interval. I tried to do this code:
curl -XPOST 'localhost:9200/news_collection/_search?pretty' -d '
{
"aggs" : {
"articles_over_time" : {
"date_histogram" : {
"field" : "publication_date",
"interval" : "day",
"format" : "MMM dd, yyyy h:mm:ss aa"
}
}
}
}'
but elastic search get me an error:
"error" : "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[_6V06L2iS4672onsoOixbA] [news_collection][0]: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndex FieldData cannot be cast to
org.elasticsearch.index.fielddata.IndexNumericFieldData]} ...
I very tried to change date format and field name but not woking.