Answer the question
In order to leave comments, you need to log in
How to sort in elasticsearch?
I have a Users table, in elastic I make a selection on it.
I have a field in each object that contains an array of dates:
{
_id: <user id>,
dates: [..., {dataFrom: <dateFrom>, dateTo: <dateTo>}]
}
Answer the question
In order to leave comments, you need to log in
Somehow your data is wrong for this. It would be better to break each entry into separate documents: id, dateFrom, dateTo. And the problem would be solved automatically.
Well, as an option, do sorting outside the elastic after the selection.
And another option is to duplicate entries in a separate index for separate documents, as I wrote above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question