How to search with multiple option in field?

I have a data sample this

data origin

info date
1 2019-03-05
2 2019-03-07
3 2019-03-04
4 2019-03-07
5 2019-03-04
6 2019-03-19
7 2019-03-01
8 2019-03-25
9 2019-03-26
10 2019-03-08
11 2019-03-03
12 2019-03-05
13 2019-03-18
14 2019-03-18
15 2019-03-02
16 2019-03-02

use elasticsearch i want sort datas same this

datas affter sort

info date
1 2019-03-05
12 2019-03-05
2 2019-03-07
4 2019-03-07
10 2019-03-08
13 2019-03-18
14 2019-03-18
6 2019-03-19
8 2019-03-25
9 2019-03-26
5 2019-03-04
3 2019-03-04
11 2019-03-03
16 2019-03-02
15 2019-03-02
7 2019-03-01

requirement is

  • the first is to day
  • next is future ascending
  • end the past decrease

How do it?.

May be you can use that: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#function-script-score

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.