Sort data based on a field value

Hello,

I am saving priority inside the data and I am looking for a way to boost the score based on the priority.

"userA":{
      "specialities": [
            {
              "speciality_priority": 3,
              "speciality_type": "a"
            },
            {
              "speciality_priority": 2,
              "speciality_type": "b"
            },
            {
              "speciality_priority": 1,
              "speciality_type": "c"
            }
      ]
}

"userB":{
      "specialities": [
            {
              "speciality_priority": 2,
              "speciality_type": "a"
            },
            {
              "speciality_priority": 1,
              "speciality_type": "b"
            },
            {
              "speciality_priority": 3,
              "speciality_type": "c"
            }
      ]
}


When I filter by speciality_type "c", I want user A have a higher score than user B because of the speciality_priority of A is 1 while the speciality_priority of B is 3

How can I achieve this in Query DSL?

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