I told you that you should try first with an example without using any client. So you make sure that:
- you understand how elasticsearch works
- where your error is coming from
So here is a full example which works:
DELETE index
PUT index
PUT index/doc/_mapping
{
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
PUT index/doc/1
{
"date": "2016-12-01 13:00:59"
}
GET index/_search
{
"query": {
"range": {
"date": {
"gte": "2016-12-01 10:00:00",
"lte": "2016-12-01 14:00:00"
}
}
}
}