I found it's allowed to access _score
inside the aggs
, but not allowed to access this field in the post_filter
queries, though it's executed after the aggs
. Is there a reason for that it's not accessible or it could be added in the Elasticsearch in the future versions?
An example query:
{
"body": {
"post_filter": {
"script": {
"script": "_score > 100 && _score < 200"
}
},
"query": {
"function_score": {
"functions": [{
"script_score": {
"script": "doc['price'].value * 100"
}
}]
}
}
},
"index": ["items"],
"type": []
}
script_score
could be much more complex, it's just an example.
Please comment also here on the github issue: https://github.com/elastic/elasticsearch/issues/20131
Related problem to this issue: http://stackoverflow.com/questions/39109511/how-to-filter-by-script-field-in-elasticsearch?noredirect=1&lq=1