The elasksearch request of a simple_score_function is very slow

I am running a query that looks like this, only with many filters:

{
  "size": 30,
  "query": {
    "function_score": {
      "query": {
        "filtered": {
          "query": {
            "match_all": {}
          }
        }
      },
      "script_score": {
        "script": "( doc['num'].value <= 3 || Math.random() < 1/doc['num'].value ) ? Math.random() : 0"
      },
      "boost_mode": "replace"
    }
  }
}

      

and I see the execution time is about 10x slower than without the Script function, even when using all possible filters.

We are running Elastic version 1.0.0 and using Java API (package org.elasticsearch.client)

Is there a way to achieve a similar result with better performance? Links for "Native Java Scripts" in the Elasticsearch tutorials seem to be broken.

+3
java performance elasticsearch


source to share


No one has answered this question yet

Check out similar questions:

3295
Why is the Android emulator so slow? How can we speed up the development of an Android emulator?
1406
Why does changing 0.1f to 0 slow down performance by 10x?
599
Solr vs ElasticSearch
452
Does anyone have benchmarks (code and results) comparing the performance of Android apps written in Xamarin C # and Java?
6
Using boolean fields in groovy script in elasticsearch - doc ['field_name']. The value doesn't work
4
elasticsearch filter support socket in functioncore
3
Function error Elasticsearch parsing request error
1
Elasticsearch scripting engine
0
Elasticsearch: Evaluating Impact in Custom Scores Field in Document pt.2
0
Elasticsearch NEST API - Query the correct index



All Articles
Loading...
X
Show
Funny
Dev
Pics