I am quite new to elasticsearch and I am impressed by all the functionality it offers. Now I have a special case, where I am not sure if elasticsearch will be able to handle it.
Overall I am searching for a type within a daterange. But in addition I need the first date before and after this daterange as well. I do not know how far these dates are away, so I can not just add a specific amount of days to the daterange.
I know this would be possible with 3 different queries, but would it be possible in just one query as well?
Here is a small example what I would like to achieve
[uuid1] = [
['id' => 1, 'date' => '1970/01/01 12:00:00', 'val' => 'ages ago'],
['id' => 2, 'date' => '2010/01/01 12:00:00', 'val' => 'randomValueSomewhereInThePast'],
['id' => 3, 'date' => '2017/01/03 12:00:00', 'val' => 'valueInTimeRange3'],
['id' => 4, 'date' => '2017/01/04 12:00:00', 'val' => 'valueInTimeRange4'],
['id' => 5, 'date' => '2017/01/05 12:00:00', 'val' => 'valueInTimeRange5'],
['id' => 6, 'date' => '2017/01/06 12:00:00', 'val' => 'valueInTimeRange6'],
['id' => 7, 'date' => '2020/01/05 12:00:00', 'val' => 'randomValueSomewhereInTheFuture']
['id' => 8, 'date' => '9999/01/05 12:00:00', 'val' => 'wayTooFarAway']
]
As you can see I got several dates. Now I have a given DateRange from
So a simple request with range would return me values 3,4,5,6. But I need values 2 & 7 aswell. These are the dates right before and right after my range. I do not know when they are so I can not just adjust the rang.
Is this possible in elasticsearch with just one query?
Thank you!