Skip to content

NullPointer on from parameter with negative value and 500 code instead of 400 error #23324

@gilfernandes

Description

@gilfernandes

I have tried to fire a silly request to ElastiSearch 5.1.1:

GET products/_search

{
  **"from": -2**,
  "size": 100, 
  "query": {
    "match": {
      "productName": "soy sauce"
    }
  },
  "sort": [
    {
      "customerRating": {
        "order": "desc"
      }
    },
    "_score",
    {
      "price" : {
        "order": "asc"
      }
    }
  ]
}

and got this:

{
  "error": {
    "root_cause": [],
    "type": "reduce_search_phase_exception",
    "reason": "[reduce] ",
    "phase": "query",
    "grouped": true,
    "failed_shards": [],
    "caused_by": {
      "type": "null_pointer_exception",
      "reason": null
    }
  },
  "status": 503
}

I had expected a 400 (user error) and a meaningful error message, like e.g: from parameter cannot be negative.

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions