forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Type removal] Ignore _type field in bulk request (opensearch-project…
…#3505) Reverts [Type removal] Remove type from BulkRequestParser and, instead, ignores _type field in bulk request. This enables bulk API bwc with external clients such as Beats and Logstash until a formal REST Version API mechanism is available for OpenSearch core. Signed-off-by: Suraj Singh <[email protected]>
- Loading branch information
1 parent
625d08a
commit a93ff13
Showing
6 changed files
with
251 additions
and
30 deletions.
There are no files selected for viewing
137 changes: 137 additions & 0 deletions
137
rest-api-spec/src/main/resources/rest-api-spec/test/bulk/11_with_deprecated_types.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
--- | ||
"Array of objects": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test_index | ||
_type: test_type | ||
_id: test_id | ||
- f1: v1 | ||
f2: 42 | ||
- index: | ||
_index: test_index | ||
_type: test_type | ||
_id: test_id2 | ||
- f1: v2 | ||
f2: 47 | ||
|
||
- do: | ||
count: | ||
index: test_index | ||
|
||
- match: {count: 2} | ||
|
||
--- | ||
"Empty _id": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: '' | ||
- f: 1 | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: id | ||
- f: 2 | ||
- index: | ||
_index: test | ||
_type: type | ||
- f: 3 | ||
- match: { errors: true } | ||
- match: { items.0.index.status: 400 } | ||
- match: { items.0.index.error.type: illegal_argument_exception } | ||
- match: { items.0.index.error.reason: if _id is specified it must not be empty } | ||
- match: { items.1.index.result: created } | ||
- match: { items.2.index.result: created } | ||
|
||
- do: | ||
count: | ||
index: test | ||
|
||
- match: { count: 2 } | ||
|
||
--- | ||
"Empty _id with op_type create": | ||
- skip: | ||
version: " - 7.4.99" | ||
reason: "auto id + op type create only supported since 7.5" | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: '' | ||
- f: 1 | ||
- index: | ||
_index: test | ||
_type: type | ||
_id: id | ||
- f: 2 | ||
- index: | ||
_index: test | ||
_type: type | ||
- f: 3 | ||
- create: | ||
_index: test | ||
_type: type | ||
- f: 4 | ||
- index: | ||
_index: test | ||
_type: type | ||
op_type: create | ||
- f: 5 | ||
- match: { errors: true } | ||
- match: { items.0.index.status: 400 } | ||
- match: { items.0.index.error.type: illegal_argument_exception } | ||
- match: { items.0.index.error.reason: if _id is specified it must not be empty } | ||
- match: { items.1.index.result: created } | ||
- match: { items.2.index.result: created } | ||
- match: { items.3.create.result: created } | ||
- match: { items.4.create.result: created } | ||
|
||
- do: | ||
count: | ||
index: test | ||
|
||
- match: { count: 4 } | ||
|
||
--- | ||
"empty action": | ||
- skip: | ||
features: headers | ||
|
||
- do: | ||
catch: /Malformed action\/metadata line \[3\], expected FIELD_NAME but found \[END_OBJECT\]/ | ||
headers: | ||
Content-Type: application/json | ||
bulk: | ||
body: | | ||
{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}} | ||
{"f1": "v1", "f2": 42} | ||
{} | ||
--- | ||
"List of strings": | ||
- do: | ||
bulk: | ||
refresh: true | ||
body: | ||
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id"}}' | ||
- '{"f1": "v1", "f2": 42}' | ||
- '{"index": {"_index": "test_index", "_type": "test_type", "_id": "test_id2"}}' | ||
- '{"f1": "v2", "f2": 47}' | ||
|
||
- do: | ||
count: | ||
index: test_index | ||
|
||
- match: {count: 2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.