I have next body
body = {
"size": 100,
"query": {
"bool": {
"filter": [
{
"term": {
"some_id_1": some_id_1
}
},
{
"term": {
"some_id_2": some_id_2
}
},
{
"term": {
"some_id_2": some_id_2
}
},
{
"terms": {
"some_strings": "a,b,c"
}
},
{
"term": {
"created_at": dt.now().strftime("%Y-%m-%d")
}
}
]
}
}
}
This will search all record by condition in term for dt.now().
Question: How i can search all documents for current month?
Will be grateful for the help.
You can use a range
query instead with some date math , like this:
{
"range": {
"created_at": {
"gte": "now/M"
}
}
}
All documents whose created_at
field is on the first day of this month or later will be returned.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.