diff --git a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloader.java b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloader.java index 53b2c360bac83..421e50c6e6181 100644 --- a/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloader.java +++ b/modules/ingest-geoip/src/main/java/org/elasticsearch/ingest/geoip/GeoIpDownloader.java @@ -170,6 +170,7 @@ int indexChunks(String name, InputStream is, int chunk, String expectedMd5) thro for (byte[] buf = getChunk(is); buf.length != 0; buf = getChunk(is)) { md.update(buf); client.prepareIndex(DATABASES_INDEX, "_doc").setId(name + "_" + chunk) + .setCreate(true) .setSource(XContentType.SMILE, "name", name, "chunk", chunk, "data", buf) .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .setWaitForActiveShards(ActiveShardCount.ALL) diff --git a/modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTests.java b/modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTests.java index 27908a15dbe23..21e035402026f 100644 --- a/modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTests.java +++ b/modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpDownloaderTests.java @@ -12,6 +12,7 @@ import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionType; +import org.elasticsearch.action.DocWriteRequest.OpType; import org.elasticsearch.action.index.IndexAction; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; @@ -164,6 +165,7 @@ public void testIndexChunks() throws IOException { client.addHandler(IndexAction.INSTANCE, (IndexRequest request, ActionListener listener) -> { int chunk = chunkIndex.getAndIncrement(); + assertEquals(OpType.CREATE, request.opType()); assertEquals("test_" + (chunk + 15), request.id()); assertEquals(XContentType.SMILE, request.getContentType()); Map source = request.sourceAsMap();