I am not able to search with date formats elastic-search
I created an index and the field mapping is showing as date-format,but the query is failing.
Before loading data,i created an index with mappings and loaded my data into elastic search.
"mappings": {
"workers": {
"person.birthDate": {
"full_name": "person.birthDate",
"mapping": {
"birthDate": {
"type": "date",
"format": "yyyy-MM-dd||epoch_millis"
}
}
}
My Input query is as below
POST _search
{
"query": {
"bool" : {
"must" : [ {
"match" : {
"person.birthDate" : {
"query" : "1968-06-15",
"type" : "date"
}
}
} ]
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": {}
}
and output is
{
"error": {
"root_cause": [
{
"type": "query_parsing_exception",
"reason": "[match] query does not support type date",
"index": "index1",
"line": 9,
"col": 33
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "index1",
"node": "RewaFar_TsGVGz1RmgOxlA",
"reason": {
"type": "query_parsing_exception",
"reason": "[match] query does not support type date",
"index": "index1",
"line": 9,
"col": 33
}
}
]
},
"status": 400
}
if i treat the date as string ,am getting data,bu the problem is i cannot do range queries if this is string
Any help on this would be appreciated. Please note am very new to elastic search.