# ResourceNotFoundException when running percolator query

**URL:** <https://discuss.elastic.co/t/resourcenotfoundexception-when-running-percolator-query/253440>\
**Category:** Elasticsearch\
**Created:** [October 27, 2020, 12:52pm UTC](https://discuss.elastic.co/t/resourcenotfoundexception-when-running-percolator-query/253440 "2020-10-27T12:52:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![makons](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/makons/32/74314_2.png) [@makons](https://discuss.elastic.co/u/makons)\
**Post date:** [October 27, 2020, 12:52pm UTC](https://discuss.elastic.co/t/resourcenotfoundexception-when-running-percolator-query/253440/1 "2020-10-27T12:52:27Z")

</div>

I'm getting a lot of `ResourceNotFoundException`s when using percolator queries, and I cannot seem to fully understand why... So the document that is reported to be missing in an index, indeed is not there, but I don't understand why is then this exception thrown? Is it unexpected to call a percolator query on a document that is not yet indexed? Should the default behavior be more in line of returning an empty result? Or am I missing something?

The full stack trace is:

```auto
org.elasticsearch.transport.RemoteTransportException: [WTHMxFY][10.10.20.130:9300][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.ResourceNotFoundException: indexed document [<index_name>/<mapping_name>/<document_id>] couldn't be found
        at org.elasticsearch.percolator.PercolateQueryBuilder.doRewrite(PercolateQueryBuilder.java:380) ~[?:?]
        at org.elasticsearch.index.query.AbstractQueryBuilder.rewrite(AbstractQueryBuilder.java:263) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.builder.SearchSourceBuilder.rewrite(SearchSourceBuilder.java:879) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.internal.ShardSearchLocalRequest.rewrite(ShardSearchLocalRequest.java:236) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.internal.ShardSearchTransportRequest.rewrite(ShardSearchTransportRequest.java:170) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.SearchService.createSearchContext(SearchService.java:526) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.SearchService.createContext(SearchService.java:475) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:457) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:253) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:330) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:327) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1544) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638) ~[elasticsearch-5.5.2.jar:5.5.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.5.2.jar:5.5.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

```

We are at the moment using an outdated ES 5.5.2, but it is the plan to update soon.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 24, 2020, 12:52pm UTC](https://discuss.elastic.co/t/resourcenotfoundexception-when-running-percolator-query/253440/2 "2020-11-24T12:52:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
