Using percolator causes INTERNAL_SERVER_ERROR with NPE

Hi,

We have a problem using percolator with ElasticSearch v2.3.2.

Here is a path how to recreate the error:

1.Create document-test index with mapping:

{
    "document-type": {
    "properties": {
      "title": {
        "type": "string"
      }
    }
  }
}

2.Index new document: document-test/document-type/1

{
  "title": "something"
}

3.Create percolator index

4.Index percolator query: percolator/.percolator/1

{
  "query": {
    "match_all": {}
  }
}

5.Execute percolator request: document-test/document-type/1/_percolate?percolate_index=percolator

and the response is:

{
  "took": 3,
  "_shards": {
    "total": 1,
    "successful": 0,
    "failed": 1,
    "failures": [
      {
        "shard": 0,
        "index": "percolator",
        "status": "INTERNAL_SERVER_ERROR",
        "reason": {
          "type": "null_pointer_exception",
          "reason": null
        }
      }
    ]
  },
  "total": 0,
  "matches": [

  ]
}

Any ideas what can be the reason?

Hi,

Can you add &percolator_type=.percolator when you percolate the existing document? It looks like it is missing and I suppose it is using the document type from the URL ("document-type") instead.

It's the same with &percolator_type=.percolator added

Did you solve this problem. I have been doing a lot of work with the Percolator lately and if you create a new Index for the Percolator queries you will need to make sure it has the mapping for your original index.

So the likely cause for this error is that the type/mapping for the used the document doesn't exist in the percolator index. Can you try adding the document-test mapping to the percolator index?

Due to how percolating an existing document works the mapping of the document to percolator need to exist in the index that holds the percolator index. This should be documented more clearly and fail with a descriptive error.