Is there are a way to filter by _score in elasticsearch?
Asked Answered
C

0

7

Is there a way to do following post_filter query valid?

I've tried different ones: _score, score, doc.score, doc._score, _source.score etc. nothing is working.

I believe there should be some solution that allows you to filter in the post_filter by the score.

{
  "body": {
    "post_filter": {
      "script": {
        "script": "_score > 100 && _score < 200"
      }
    },
    "query": {
      "function_score": {
        "functions": [{
          "script_score": {
            "script": "doc['price'].value * 100"
          }
        }]
      }
    }
  },
  "index": ["items"],
  "type": []
}

Similar question on the ES group: http://elasticsearch-users.115913.n3.nabble.com/Filter-on-score-td4044742.html

Cicily answered 23/8, 2016 at 16:19 Comment(2)
Have you tried min_score? I think it will help you with part of your question. [link]elastic.co/guide/en/elasticsearch/reference/current/…Inquest
Thanks! Yes, I found this solution, but it solves problem only partly.Cicily

© 2022 - 2024 — McMap. All rights reserved.