Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PercolateException[failed to percolate]; nested - Percolate API on nested document

I am using elasticsearch 1.1.

Normally in this version, percolator on nested documents should work.

Although, i am trying to do this but I get the following error:

failures: [

    {
        index: test
        shard: 4
        reason: BroadcastShardOperationFailedException[[test][4] ]; nested: PercolateException[failed to percolate]; nested: ElasticsearchIllegalArgumentException[Nothing to percolate]; 
    }

]

I have the following percolator (sorry elasticsearch head removed me all the quotes):

{

    _index: test
    _type: .percolator
    _id: 27
    _version: 1
    _score: 1
    _source: {
        query: {
            filtered: {
                query: {
                    match_all: { }
                }
                filter: {
                    nested: {
                        filter: {
                            term: {
                                city: london
                            }
                        }
                        path: location
                    }
                }
            }
        }
    }

}

And while trying to percolate this document I am getting the error:

{
  ...
  "location": {
    "date": "2014-05-05T15:07:58",
    "namedplaces": {
      "city": "london"
    }
  }
}

Any idea why it doesn't work ?

EDIT :

In elasticsearch log I got more precision about the error:

[2014-05-06 13:33:48,972][DEBUG][action.percolate         ] [Tomazooma] [test][2], node[H42BBxajRs2w2NmllMnp7g], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.percolate.PercolateReque
st@7399452e]
org.elasticsearch.percolator.PercolateException: failed to percolate
        at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:198)
        at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:55)
        at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$2.run(TransportBroadcastOperationAction.java:226)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: org.elasticsearch.ElasticsearchIllegalArgumentException: Nothing to percolate
        at org.elasticsearch.percolator.PercolatorService.percolate(PercolatorService.java:187)
        at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:194)
        ... 5 more
like image 379
razafinr Avatar asked Sep 30 '22 21:09

razafinr


1 Answers

The documentation of ES is not really clear about it. But when you look at this page, you will see that when you are percolating you need to surround your indexed document by doc{}. It is indeed compulsory otherwise the exception that you've got will appears:

Try to do so on :

   {
"doc":{
  ...
  "location": {
    "date": "2014-05-05T15:07:58",
    "namedplaces": {
      "city": "london"
    }
  }
}
}

I hope it will help ;-)

like image 162
Blblblblblblbl Avatar answered Oct 04 '22 18:10

Blblblblblblbl