Fix REST spec for exists
A previous change aligned the handling of the GET document and HEAD document APIs. This commit aligns the specification for these two APIs as well, and fixes a failing test. Relates #23196
This commit is contained in:
parent
1cd1ff6010
commit
2925a81cc9
|
@ -44,7 +44,6 @@ import static org.hamcrest.CoreMatchers.containsString;
|
||||||
|
|
||||||
public class CrudIT extends ESRestHighLevelClientTestCase {
|
public class CrudIT extends ESRestHighLevelClientTestCase {
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/23196")
|
|
||||||
public void testExists() throws IOException {
|
public void testExists() throws IOException {
|
||||||
{
|
{
|
||||||
GetRequest getRequest = new GetRequest("index", "type", "id");
|
GetRequest getRequest = new GetRequest("index", "type", "id");
|
||||||
|
@ -64,10 +63,7 @@ public class CrudIT extends ESRestHighLevelClientTestCase {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
GetRequest getRequest = new GetRequest("index", "type", "does_not_exist").version(1);
|
GetRequest getRequest = new GetRequest("index", "type", "does_not_exist").version(1);
|
||||||
ElasticsearchException exception = expectThrows(ElasticsearchException.class,
|
assertFalse(execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
||||||
() -> execute(getRequest, highLevelClient()::exists, highLevelClient()::existsAsync));
|
|
||||||
assertEquals(RestStatus.BAD_REQUEST, exception.status());
|
|
||||||
assertThat(exception.getMessage(), containsString("/index/type/does_not_exist?version=1: HTTP/1.1 400 Bad Request"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
|
"stored_fields": {
|
||||||
|
"type": "list",
|
||||||
|
"description" : "A comma-separated list of stored fields to return in the response"
|
||||||
|
},
|
||||||
"parent": {
|
"parent": {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "The ID of the parent document"
|
"description" : "The ID of the parent document"
|
||||||
|
@ -42,6 +46,27 @@
|
||||||
"routing": {
|
"routing": {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "Specific routing value"
|
"description" : "Specific routing value"
|
||||||
|
},
|
||||||
|
"_source": {
|
||||||
|
"type" : "list",
|
||||||
|
"description" : "True or false to return the _source field or not, or a list of fields to return"
|
||||||
|
},
|
||||||
|
"_source_exclude": {
|
||||||
|
"type" : "list",
|
||||||
|
"description" : "A list of fields to exclude from the returned _source field"
|
||||||
|
},
|
||||||
|
"_source_include": {
|
||||||
|
"type" : "list",
|
||||||
|
"description" : "A list of fields to extract and return from the _source field"
|
||||||
|
},
|
||||||
|
"version" : {
|
||||||
|
"type" : "number",
|
||||||
|
"description" : "Explicit version number for concurrency control"
|
||||||
|
},
|
||||||
|
"version_type": {
|
||||||
|
"type" : "enum",
|
||||||
|
"options" : ["internal", "external", "external_gte", "force"],
|
||||||
|
"description" : "Specific version type"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,3 +25,12 @@
|
||||||
id: 1
|
id: 1
|
||||||
|
|
||||||
- is_true: ''
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
exists:
|
||||||
|
index: test_1
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
Loading…
Reference in New Issue