OpenSearch/rest-api-spec/test/search/30_template_query_execution...

42 lines
1.0 KiB
YAML

---
"Template query":
- 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:
body: { "query": { "template": { "query": { "term": { "text": { "value": "{{template}}" } } }, "params": { "template": "value1" } } } }
- match: { hits.total: 1 }
- do:
search:
body: { "query": { "template": { "query": {"match_{{template}}": {}}, "params" : { "template" : "all" } } } }
- match: { hits.total: 2 }
- do:
search:
body: { "query": { "template": { "query": "{ \"term\": { \"text\": { \"value\": \"{{template}}\" } } }", "params": { "template": "value1" } } } }
- match: { hits.total: 1 }
- do:
search:
body: { "query": { "template": { "query": "{\"match_{{template}}\": {}}", "params" : { "template" : "all" } } } }
- match: { hits.total: 2 }