Search code examples
elasticsearchkibana-4

DocumentAlreadyExistsException while using kibana 4


i referred to so many links related to DocumentAlreadyExistsException but most of them were caused while using elastic search api or while using elastic search in some code. but in my case i'm just using kibana 4 and not a code. does any one know when is this issue caused while using kibana 4? below is the exception.

[.kibana][[.kibana][0]] DocumentAlreadyExistsException[[dashboard][New-Dashboard]: document already exists]
    at org.elasticsearch.index.engine.InternalEngine.innerCreateNoLock(InternalEngine.java:411)
    at org.elasticsearch.index.engine.InternalEngine.innerCreate(InternalEngine.java:369)
    at org.elasticsearch.index.engine.InternalEngine.create(InternalEngine.java:341)
    at org.elasticsearch.index.shard.IndexShard.create(IndexShard.java:517)
    at org.elasticsearch.index.engine.Engine$Create.execute(Engine.java:789)
    at org.elasticsearch.action.support.replication.TransportReplicationAction.executeIndexRequestOnPrimary(TransportReplicationAction.java:1073)
    at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:170)
    at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.performOnPrimary(TransportReplicationAction.java:579)
    at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase$1.doRun(TransportReplicationAction.java:452)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Solution

  • This usually happens when you try to save a kibana object (saved search, visualization or dashboard) with a name that already exists (since kibana uses a slug of the name for the id as well).

    This exception is thrown since kibana sends the REST request with &op_type=create purposely which, throws an exception when the object id already exists.
    Then kibana handles this by asking you if you're sure you want to override the object being saved, and if you click 'yes' then the same REST call is made but without op_type=create.