Skip to content

Commit

Permalink
Standardize underscore requirements in parameters
Browse files Browse the repository at this point in the history
Stardardize underscore requirements in parameters across different type of
requests:
_index, _type, _source, _id keep their underscores
params like version and retry_on_conflict will be without underscores
In 6.x these parameters are deprecated and produce
deprecated warnings.

BulkRequest, MultiGetRequest, TermVectorcRequest, MoreLikeThisQuery
were changed

Closes #26886
  • Loading branch information
mayya-sharipova committed Nov 7, 2017
1 parent f3cdf8d commit b1c4450
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

---
"Deprecated parameters should produce warning in Bulk query":
# MODIFY in 7.x as these throw errors instead of warnings

- skip:
version: " - 6.99.99"
reason: some parameters are deprecated starting from 7.0, their equivalents without underscore are used instead
features: "warnings"

- do:
bulk:
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_version": 1 } }
{ "doc": { "f1": "v1" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2", "_version": 1 } }
{ "doc": { "f1": "v2" } }
warnings:
- "Deprecated field [_version] used, expected [version] instead"

- do:
bulk:
body: |
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_1", "_routing": "test1" } }
{ "doc": { "f1": "v1" } }
{ "update": { "_index": "test_index", "_type": "test_type", "_id": "test_id_2", "_routing": "test1" } }
{ "doc": { "f1": "v2" } }
warnings:
- "Deprecated field [_routing] used, expected [routing] instead"
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

---
"Deprecated parameters should produce warning in Multi Get query":
# MODIFY in 7.x as these throw errors instead of warnings

- skip:
version: " - 6.99.99"
reason: some parameters are deprecated starting from 7.0, their equivalents without underscore are used instead
features: "warnings"

- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }

- do:
index:
index: test_1
type: test
id: 2
body: { foo: baz }

- do:
mget:
body:
docs:
- { _index: test_1, _type: test, _id: 1, _routing : test1 }
- { _index: test_1, _type: test, _id: 2, _routing : test1 }
warnings:
- "Deprecated field [_routing] used, expected [routing] instead"

---
"Deprecated parameters should produce warning in Multi Get query2":
# MODIFY in 7.x as these throw errors instead of warnings

- skip:
version: " - 6.99.99"
reason: some parameters are deprecated starting from 7.0, their equivalents without underscore are used instead
features: "warnings"

- do:
index:
index: test_1
type: test
id: 1
body: { foo: bar }

- do:
index:
index: test_1
type: test
id: 2
body: { foo: baz }

- do:
mget:
body:
docs:
- { _index: test_1, _type: test, _id: 1, _version : 1 }
- { _index: test_1, _type: test, _id: 2, _version : 1 }
warnings:
- "Deprecated field [_version] used, expected [version] instead"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

---
"Deprecated parameters should produce warning in Term Vectors query":
# MODIFY in 7.x as these throw errors instead of warnings

- skip:
version: " - 6.99.99"
Expand Down Expand Up @@ -52,44 +53,3 @@
"_version_type" : "external"
warnings:
- "Deprecated field [_version_type] used, expected [version_type] instead"



---
"Deprecated camel case parameters should fail in Term Vectors query":

- skip:
version: " - 7.99.99"
reason: camel case parameters such as version_type should fail starting from 8.0
features: "warnings"

- do:
indices.create:
index: testidx
body:
mappings:
testtype:
properties:
text:
type : "text"
term_vector : "with_positions_offsets"

- do:
index:
index: testidx
type: testtype
id: testing_document
body: {"text" : "The quick brown fox is brown."}

- do:
catch: bad_request
mtermvectors:
"term_statistics" : true
"body" :
"docs":
-
"_index" : "testidx"
"_type" : "testtype"
"_id" : "testing_document"
"version" : 1
"versionType" : "external"

0 comments on commit b1c4450

Please sign in to comment.