Why bulk update never conflicts with update-by-query requests in Elasticsearch

Why bulk update never conflicts with update-by-query requests in Elasticsearch

Questions : Why bulk update never conflicts with update-by-query requests in Elasticsearch


I keep two scripts running, one sending bulk in4codes_update-by-query requests to index:

while true; do s=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 10) curl -s -X POST 'localhost:9200/test/_bulk' -H 'Content-Type: application/x-ndjson' -d  '{ "update": { "_index": "test", "_id": "1" } } { "doc": { "name": "update", "foo": "'$s'" } } { "update": { "_index": "test", "_id": "2" } } { "doc": { "name": "update", "foo": "'$s'" } } { "update": { "_index": "test", "_id": "3" } } { "doc": { "name": "update", "foo": "'$s'" } } ' echo '' done 

And another sending update-by-query requests in4codes_update-by-query on these documents (I have to sleep after in4codes_update-by-query each request since it may conflict with the in4codes_update-by-query previous one if requests sent too in4codes_update-by-query frequently):

while true; do s=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 10) curl -s -X POST 'localhost:9200/test/_update_by_query' -H 'Content-Type: application/json' -d  '{ "query": { "match": { "name": { "query": "update" } } }, "script": { "lang": "painless", "source": "ctx._source['"'foo'"'] = '"'$s'"'" } }' echo '' sleep 1 done 

From the output of two scripts, there’s no in4codes_update-by-query conflict failure in bulk response. All in4codes_update-by-query conflicts happened on the update-by-query in4codes_update-by-query side.

According to the conflict error message: in4codes_update-by-query version conflict, required seqNo [66], in4codes_update-by-query primary term [1]. current document has seqNo in4codes_update-by-query [67] and primary term [1], seems that the in4codes_update-by-query conflict happens when the operation is being in4codes_update-by-query copied from primary shard to replica. But in4codes_update-by-query bulk also need to do that and increase in4codes_update-by-query seqNo, right?

Is there any possibility that in4codes_update-by-query update-by-query succeeds but bulk conflicts in4codes_update-by-query and fails sometimes?

Total Answers 1

Answers 1 : of Why bulk update never conflicts with update-by-query requests in Elasticsearch

Your bulk requests always use the index in4codes_elasticsearch command and so override the document (if in4codes_elasticsearch any) or create a new document, so there in4codes_elasticsearch can never be a conflict.

The update-by-query requests are… in4codes_elasticsearch well, updates, and the conflicts can in4codes_elasticsearch only happen on this side.

If your update request comes after the a in4codes_elasticsearch bulk request has overridden an existing in4codes_elasticsearch document, you get a conflict.

If your bulk request comes after the in4codes_elasticsearch update request has updated a document, in4codes_elasticsearch nothing happens because the bulk request in4codes_elasticsearch will override the changes made by the in4codes_elasticsearch update request since it uses the index in4codes_elasticsearch command.


Answer Link
  • Unable to run NoraUI mvn verify goal
  • Unable to run my app on emulator in VS Code
  • Unable to run multiple instances of libVLC(MobileVLCKit) in IOS via flutter framework
  • Unable to run make on griddb source on ubuntu 20.04 (building from source)
  • Unable to run latexindent macOS Monterey 12.0.1
  • Unable to run kotlinc-native command
  • Unable to run JUnit Test… Java.lang.ExceptionInInitializerError (Android Studio)
  • Unable to run java with -Xmx > 966m
  • Unable to run ionic cap run android from wsl2 inorder to start android emulator
  • Unable to run Intel HAXM installer: Cannot start process, the working directory does not exist
  • fs
  • Unable to run Google Analytics sample code
  • unable to run flutter run after upgarding to flutter 2.8.0 from 2.5.3
  • Unable to run Django with PostgreSQL in Docker
  • Unable to Run Container Using testcontainers
  • Unable to run ClojureScript Hello World program, Error building classpath. Error reading edn.
  • unable to run client command for apache karaf 4.3.3 through remote server
  • Unable to run c program 2nd time using eclipse
  • unable to run c++ in visual studio code on m1 chipset
  • Unable to run Android Instrumented Tests
  • Unable to run adb, check your Android SDK installation and ANDROID_SDK_ROOT environment variable: …AndroidSdkplatform-toolsadb.exe
  • Unable to run a singlespecific .spec.ts file through angular cli using ng test –include option
  • Unable to run a Mango query
  • Unable to return response back to view in laravel from package
  • Unable to return object reference in std::optional
  • Unable to return NULL in a function that expects an integer return type
  • Unable to return correct change in JavaScript Cash Register
  • Unable to retrieve version information from Elasticsearch nodes. Request timed out
  • Unable to retrieve values from Axios Response data
  • Unable to retrieve dotenv JWT secret Error: secretOrPrivateKey must have a value
  • Unable to resolve your shell environment
  • Unable to resolve token for FCM while implementing Push notification for Xamarin
  • Unable to resolve the request yii
  • Unable to resolve service for type Swashbuckle.AspNetCore.Swagger.ISwaggerProvider
  • Unable to resolve service for type Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger