How to suppress DocumentMissingException?

(Attila Nagy) #1


I have the following workflow in an application

  1. update the doc with fresh data, if it succeeds, work is done
  2. if the doc was missing, do some local work and when that succeeds, index the data

In step 2 it's important that the doc must only appear in ES when the local work is successfully done.

This works nicely, my only problem is every update on a -yet- nonexistent doc yields about 1.7 kiBs of stack trace into the ES log (and to that matter, onto its stdout by default), which is absolutely wasted, both CPU and IO/storage wise.

This is it:
[2016-02-27 15:31:54,266][INFO ][rest.suppressed ] /idx1/object/954003.84.t/_update Params: {index=idx1, id=954003.84.t, type=object, retry_on_conflict=8}
RemoteTransportException[[dev00][][indices:data/write/update[s]]]; nested: DocumentMissingException[[object][954003.84.t]: document missing];
Caused by: [idx1][[idx1][2]] DocumentMissingException[[object][954003.84.t]: document missing]
at org.elasticsearch.action.update.UpdateHelper.prepare(
at org.elasticsearch.action.update.UpdateHelper.prepare(
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(
at org.elasticsearch.action.update.TransportUpdateAction.shardOperation(
at org.elasticsearch.transport.TransportService$4.doRun(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$

How do I silence this?

(Thomas Decaux) #2

Use upsert:

Or you can try to change the log level:

(Attila Nagy) #3

Upsert is not good for me, because of #2 (I have work to do before indexing data).
I want to disable only this exception, because it's excess and hurts performance badly. If I change the loglevel, it affects many other events.

(Thomas Decaux) #4

So first, check that the doc exists or not in ES, then update or insert.

Note: you can use to bulk operations.

(Attila Nagy) #5

That's what I do now, but I feel it totally unecessary, when a simple update should do the job, without the overhead of that extra get.

(system) #6