Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When script_score script returns NaN, entire request fails with a confusing error message #2426

Closed
imotov opened this issue Nov 21, 2012 · 2 comments

Comments

Projects
None yet
4 participants
@imotov
Copy link
Member

commented Nov 21, 2012

Repro: https://gist.github.com/4122515
Error message:

{
    "error": "SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {IllegalArgumentException[docID must be >= 0 and < maxDoc=3 (got docID=2147483647)]}]",
    "status": 500
}
@nekulin

This comment has been minimized.

Copy link

commented Mar 16, 2013

how do you solved this problem?

@clintongormley clintongormley changed the title When custom_score script returns NaN, entire request fails with a confusing error message When script_score script returns NaN, entire request fails with a confusing error message Nov 29, 2014

@clintongormley

This comment has been minimized.

Copy link
Member

commented Nov 29, 2014

This is still an issue with script_score in the function_score query:

DELETE /test-idx

PUT /test-idx
{
  "settings": {
    "index": {
      "number_of_shards": 1,
      "number_of_replicas": 0
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "name": {
          "type": "string"
        }
      }
    }
  }
}

PUT /test-idx/doc/1
{"name":"foo"}

PUT /test-idx/doc/2
{"name":"bar"}

PUT /test-idx/doc/3
{"name":"baz"}

GET /test-idx/doc/_search
{
  "query": {
    "function_score": {
      "query": {
        "match_all": {}
      },
      "script_score": {
        "script": "Float.NaN"
      }
    }
  }
}

The above throws this exception:

"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[QXq3EIF5RcqhjIVRReuKhQ][test-idx][0]: IllegalArgumentException[docID must be >= 0 and < maxDoc=3 (got docID=2147483647)]}]"

@tlrx tlrx self-assigned this Dec 2, 2014

tlrx added a commit to tlrx/elasticsearch that referenced this issue Dec 8, 2014

Scripting: Add explicit error message when script_score script return…
…s NaN

When a scoring script returns not a number, the current message is confusing (IllegalArgumentException[docID must be >= 0 and < maxDoc=3 (got docID=2147483647)]). This commit adds the error message ScriptException[script score function returns a wrong score: NaN].

Closes elastic#2426

@tlrx tlrx closed this in #8750 Dec 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.