Перекладывание SQL-запроса на эластик без изменения формата данных (трансформирования перед индексацией)
Вводные:
- Документы с коллекциями nested.
- Коллекция представляет собой историю одной и той же сущности. Одна версия является актуальной и отличается отсутствием флага archived.
- Актуальная версия может как присутствовать, так и нет. В случае отсутствия поиск производится по архивированным версиям.
- Nested ожидаемо содержит прочие данные, которые участвуют в запросе.
Решение состоит из композиции логических запросов: