Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query Templates: Adding dedicated /_search/template endpoint
In order to simplify query template execution an own endpoint has been added Closes #5353
- Loading branch information
Showing
12 changed files
with
601 additions
and
100 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
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,23 @@ | ||
{ | ||
"search-template": { | ||
"documentation": "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-search.html", | ||
"methods": ["GET", "POST"], | ||
"url": { | ||
"path": "/_search/template", | ||
"paths": ["/_search/template", "/{index}/_search/template", "/{index}/{type}/_search/template"], | ||
"parts": { | ||
"index": { | ||
"type" : "list", | ||
"description" : "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" | ||
}, | ||
"type": { | ||
"type" : "list", | ||
"description" : "A comma-separated list of document types to search; leave empty to perform the operation on all types" | ||
} | ||
} | ||
}, | ||
"body": { | ||
"description": "The search definition template and its params" | ||
} | ||
} | ||
} |
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,29 @@ | ||
--- | ||
"Template search request": | ||
|
||
- do: | ||
index: | ||
index: test | ||
type: testtype | ||
id: 1 | ||
body: { "text": "value1" } | ||
- do: | ||
index: | ||
index: test | ||
type: testtype | ||
id: 2 | ||
body: { "text": "value2" } | ||
- do: | ||
indices.refresh: {} | ||
|
||
- do: | ||
search-template: | ||
body: { "template" : { "query": { "term": { "text": { "value": "{{template}}" } } } }, "params": { "template": "value1" } } | ||
|
||
- match: { hits.total: 1 } | ||
|
||
- do: | ||
search-template: | ||
body: { "template" : { "query": { "match_{{template}}": {} } }, "params" : { "template" : "all" } } | ||
|
||
- match: { hits.total: 2 } |
Oops, something went wrong.