Hi i am using this curl to create mapping -
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD -X PUT "https://DNS:9200/elasticdate-6?pretty=" -H 'content-type: application/json' -H 'user-agent: -lContent-Type: application/json' -d '{
"mappings": {
"properties": {
"title": {"type": "text"},
"text": {"type": "text"},
"updated_at" : {
"type" : "date",
"format" : "EEE LLL dd HH:mm:ss z YYYY"
},
"updated_at-1" : {
"type" : "date",
"format" : "EEE LLL dd HH:mm:ss z yyyy"
},
"date": {
"type": "date"
},
"date1": {
"type": "date",
"format": "YYYY-MM-dd"
}
}
},
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
}
}'
I inserted this data -
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD -X POST "https://DNS:9200/elasticdate-6/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
"title": "test-1",
"text": "test-1 text",
"updated_at":"Wed Jun 07 19:58:36 IST 2023",
"updated_at-1":"Wed Jun 07 19:58:36 IST 2023",
"date":"2023-06-07",
"date1":"2023-06-07"
}
'
Now when i am using search -
curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD -X POST "https://DNS:9200/elasticdate-6/_search/?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"range": {
"date1": {
"gte": "2023-05-08",
"lte": "2023-06-06"
}
}
}
}
'
i am getting below results which is not expected
"hits" : [
{
"_index" : "elasticdate-6",
"_id" : "STkzf4oBM5G1hHAlhdMR",
"_score" : 1.0,
"_source" : {
"title" : "test-1",
"text" : "test-1 text",
"updated_at" : "Wed Jun 07 19:58:36 IST 2023",
"updated_at-1" : "Wed Jun 07 19:58:36 IST 2023",
"date" : "2023-06-07",
"date1" : "2023-06-07"
}
}
]
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.