I'm looking a way to get the data from "yesterday" instead of:
"range" : {
"price" : {
"gt" : "2014-11-24",
"lt" : "2014-11-26"
}
}
I would like something like:
"range" : {
"price" : {
"eq" : "2014-11-25"
}
}
Does anybody think it could be possible?
I'm thinking of something like:
"range" : {
"price" : {
"gt" : "now-2d",
"lt" : "now"
}
}
But I would like to get data from 00:00 am to 00:00 pm
The answer from @andrei-stefan is the way to do this, but I wanted to add a little extra example for other people hitting this question.
If you wanted to get data from yesterday between 12:00pm and 1:00pm rather than the whole day, you could do that with a little more date math:
"query": {
"range": {
"price": {
"gt": "now-1d/d+12h",
"lt": "now-1d/d+13h"
}
}
}
https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#date-math
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With