Bladeren bron

Add test for item-level error when no write index defined for an alias in bulk API (#55503)

Co-authored-by: Jake Landis <jake.landis@elastic.co>
bellengao 5 jaren geleden
bovenliggende
commit
c0dfb45191
1 gewijzigde bestanden met toevoegingen van 30 en 0 verwijderingen
  1. 30 0
      rest-api-spec/src/main/resources/rest-api-spec/test/bulk/10_basic.yml

+ 30 - 0
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/10_basic.yml

@@ -199,3 +199,33 @@
       catch: missing
       indices.get:
         index: new_index_not_created
+---
+"Return item-level error when no write index defined for an alias":
+
+  - do:
+      indices.create:
+        index: test_index1
+  - do:
+      indices.create:
+        index: test_index2
+
+  - do:
+      indices.put_alias:
+        index: test_index1
+        name: test_index
+  - do:
+      indices.put_alias:
+        index: test_index2
+        name: test_index
+
+  - do:
+      bulk:
+        body:
+          - '{"index": {"_index": "test_index"}}'
+          - '{"field": "test"}'
+
+  - match: { errors: true }
+  - match: { items.0.index.status: 400 }
+  - match: { items.0.index.error.type: illegal_argument_exception }
+  - match: { items.0.index.error.reason: "no write index is defined for alias [test_index]. The write index may be explicitly disabled using is_write_index=false or the alias points to multiple indices without one being designated as a write index" }
+