I'm looking at removing the relevancy score for some of my terms queries to speed them up. I understand how to do that as part of an elasticsearch query but how might I go about setting the constant_score in a kibana visualization to not deal with relevancy scoring? Does that go in the json input section of the visualization?
By terms queries do you mean the terms aggregation or the a filter using the terms clause. If it is the latter, you can enter Elasticsearch filter DSL by clicking the "Edit as Query DSL" button in the popover:
Thank you. That is exactly what I was looking for. I figured there was a place to do this since I couldn't see how to do it in the kibana/visualizations. I'm running into a small issue with the query. I'm trying to put this filter in place and I'm getting nothing returned. I'm using the example filter here: Constant score query | Elasticsearch Guide [7.13] | Elastic. This is the code I'm using:
My goal here is to not have to apply any relevancy scoring to the field filename Is this possible or is there another method of achieving this? Thank you for your help.
As you can see, the terms matching (geo.src equals US) goes into the filter of a bool query.
This is what Elasticsearch documentation has to say about filter:
filter|The clause (query) must appear in matching documents. However unlike must the score of the query will be ignored. Filter clauses are executed in filter context, meaning that scoring is ignored and clauses are considered for caching.
So as long as your clauses end up in the top level filter (which is the case for KQL and filter pills), you don't have to worry about scoring.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.