How to (temporarily) stop Elasticsearch from expunging deleted documents? -


in my usecase i'm trying synchronize 2 elasticsearch indices. due versioning acutally quite simple. however, want keep writing @ time while i'm doing this.

okay, steps want perform in chronological order:

  1. clients write (index, delete, update) cluster c1
  2. create new index c2 (clients keep writing c1)
  3. copy data cluster c1 c2 (clients keep writing c1)
  4. switch clients c2
  5. synchronize changes c1 c2 (clients keep writing c2)
  6. shutdown c1

step #5 step i'm looking at. have make sure changes written c2 aren't overwritten data c1. using versioning it's rather simple writes index operations fail (versionconflictengineexception). assuming following situation:

  1. a document updated on c1 right after #3 (v2 on c1, v1 on c2)
  2. the same document deleted right after #4 (v2 on c1, deleted on c2)
  3. synchronizing try reindex v2 on c2

i know elasticsearch keeps deleted documents around while:

# index document 1:4 $ curl -xput 'http://localhost:9200/test/test/1?version=4&version_type=external' -d '{"message": "test"}' {"ok":true,"_index":"test","_type":"test","_id":"1","_version":4}  # delete document 1:6 $ curl -xdelete 'http://localhost:9200/test/test/1?version=6&version_type=external' {"ok":true,"found":true,"_index":"test","_type":"test","_id":"1","_version":6}  # index document 1:4 (error!) $ curl -xput 'http://localhost:9200/test/test/1?version=4&version_type=external' -d '{"message": "test"}' {"error":"versionconflictengineexception[[test][2] [test][1]: version conflict, current [6], provided [4]]","status":409}  # wait time  # index document 1:4 (success!) $ curl -xput 'http://localhost:9200/test/test/1?version=4&version_type=external' -d '{"message": "test"}' {"ok":true,"_index":"test","_type":"test","_id":"1","_version":4} 

the problem "wait time" part. have rely on deleted documents unknown amount of time. therefore need control time disallowing expunging of deleted documents while i'm running #5. how this?

crossposted elasticsearch group (and related question)

the "wait time" part defined index.gc_deletes setting on per index basis , set "60s" default. can dynamically changed using update index settings command.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -