W
W
WotanWeb2022-03-17 07:53:16
elasticsearch
WotanWeb, 2022-03-17 07:53:16

Is it possible to sort with conditions in elasticsearch?

Good day!
There is a need to sort with conditions.
For example:
if stop_in has not yet arrived, but start_in has already arrived, then sort by start_in DESC
if stop_in has already arrived, then sort by stop_in ASC

Is it possible to implement this on elastic?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WotanWeb, 2022-03-17
@WotanWeb

As a result, I used the opportunity to write scripts and set _score through them.
The logic added the required number of _score points and sorts according to this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question