Reputation: 140
I have some documents where in each document , there is a startDate
and endDate
date fields. I need all documents with both these value as same. I couldn't find any query which will help me to do it.
Upvotes: 5
Views: 84
Reputation: 19273
This can be achieved in 2 manner
Upvotes: 1
Reputation: 609
Elasticsearch supports script filters, which you can use in this case . More Info Something like this is what you will need -
POST /<yourIndex>/<yourType>/_search?
{
"query": {
"filtered": {
"filter": {
"script": {
"script": "doc['startDate'].value == doc['endDate'].value"
}
}
}
}
}
Upvotes: 3