2014-01-24 06:27:00 -05:00
|
|
|
---
|
|
|
|
"Template query":
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test
|
|
|
|
type: testtype
|
|
|
|
id: 1
|
|
|
|
body: { "text": "value1" }
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: test
|
|
|
|
type: testtype
|
|
|
|
id: 2
|
2014-03-20 12:16:04 -04:00
|
|
|
body: { "text": "value2 value3" }
|
2014-01-24 06:27:00 -05:00
|
|
|
- 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 }
|
2014-03-20 12:16:04 -04:00
|
|
|
|
|
|
|
- do:
|
|
|
|
search:
|
|
|
|
body: { "query": { "template": { "query": "{\"query_string\": { \"query\" : \"{{query}}\" }}", "params" : { "query" : "text:\"value2 value3\"" } } } }
|
|
|
|
|
|
|
|
|
|
|
|
- match: { hits.total: 1 }
|