forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added spec + tests for the GetFieldMapping API
Introduced in elastic#3941
- Loading branch information
Showing
5 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
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,31 @@ | ||
{ | ||
"indices.get_mapping": { | ||
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping/", | ||
"methods": ["GET"], | ||
"url": { | ||
"path": "/_mapping/field/{field}", | ||
"paths": ["/_mapping/field/{field}", "/{index}/_mapping/field/{field}", "/{index}/{type}/_mapping/field/{field}"], | ||
"parts": { | ||
"index": { | ||
"type" : "list", | ||
"description" : "A comma-separated list of index names" | ||
}, | ||
"type": { | ||
"type" : "list", | ||
"description" : "A comma-separated list of document types" | ||
}, | ||
"field": { | ||
"type" : "list", | ||
"description" : "A comma-separated list of fields" | ||
} | ||
}, | ||
"params": { | ||
"include_defaults": { | ||
"type" : "boolean", | ||
"description" : "specifies default mapping values should be returned" | ||
} | ||
} | ||
}, | ||
"body": null | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
rest-api-spec/test/indices.get_field_mapping/10_basic.yaml
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,68 @@ | ||
--- | ||
setup: | ||
- skip: | ||
version: "0 - 0.90.5" | ||
reason: "get field mapping was added in 0.90.6" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: string | ||
|
||
--- | ||
"Get field mapping with no index and type": | ||
- do: | ||
indices.get_field_mapping: | ||
field: text | ||
|
||
- match: {test_index.test_type.text.mapping.text.type: string} | ||
|
||
--- | ||
"Get field mapping by index only": | ||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
field: text | ||
|
||
- match: {test_index.test_type.text.mapping.text.type: string} | ||
|
||
--- | ||
"Get field mapping by type & field": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
field: text | ||
|
||
- match: {test_index.test_type.text.mapping.text.type: string} | ||
|
||
--- | ||
"Get field mapping by type & field, with another field that doesn't exist": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
field: [ text , text1 ] | ||
|
||
- match: {test_index.test_type.text.mapping.text.type: string} | ||
- is_false: test_index.test_type.text1 | ||
|
||
--- | ||
"Get field mapping with include_defaults": | ||
|
||
- do: | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
field: text | ||
include_defaults: true | ||
|
||
- match: {test_index.test_type.text.mapping.text.type: string} | ||
- match: {test_index.test_type.text.mapping.text.analyzer: default} |
24 changes: 24 additions & 0 deletions
24
rest-api-spec/test/indices.get_field_mapping/20_missing_field.yaml
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,24 @@ | ||
--- | ||
"Raise 404 when field doesn't exist": | ||
- skip: | ||
version: "0 - 0.90.5" | ||
reason: "get field mapping was added in 0.90.6" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: string | ||
analyzer: whitespace | ||
|
||
- do: | ||
catch: missing | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: test_type | ||
field: not_text | ||
|
24 changes: 24 additions & 0 deletions
24
rest-api-spec/test/indices.get_field_mapping/30_missing_type.yaml
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,24 @@ | ||
--- | ||
"Raise 404 when type doesn't exist": | ||
- skip: | ||
version: "0 - 0.90.5" | ||
reason: "get field mapping was added in 0.90.6" | ||
|
||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
mappings: | ||
test_type: | ||
properties: | ||
text: | ||
type: string | ||
analyzer: whitespace | ||
|
||
- do: | ||
catch: missing | ||
indices.get_field_mapping: | ||
index: test_index | ||
type: not_test_type | ||
field: text | ||
|
14 changes: 14 additions & 0 deletions
14
rest-api-spec/test/indices.get_field_mapping/40_missing_index.yaml
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,14 @@ | ||
--- | ||
"Raise 404 when index doesn't exist": | ||
- skip: | ||
version: "0 - 0.90.5" | ||
reason: "get field mapping was added in 0.90.6" | ||
|
||
- do: | ||
catch: missing | ||
indices.get_mapping: | ||
index: test_index | ||
type: type | ||
field: field | ||
|
||
|