A
A
Anton2021-03-10 11:46:22
elasticsearch
Anton, 2021-03-10 11:46:22

How to filter records by date in elasticsearch with date modification?

To filter by date, I use the following queries:

'body'  => [
    'query' => [
        'bool' => [
             'filter' => [
                  'range' => [
                      'expire_at' => [
                          'gte' => now()
                      ]
                 ]
             ]
         ]
    ]
]

UPD: Each entry has one more date field - last_checked. The question is how to select records in which for example expire_at - 7 дней > last_checked?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
siri0s, 2021-03-19
@siri0s

Try to use script-request https://www.elastic.co/guide/en/elasticsearch/ref...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question