2014-02-11 07:46:54 -05:00
|
|
|
---
|
|
|
|
setup:
|
|
|
|
- do:
|
|
|
|
indices.create:
|
|
|
|
index: nestedindex
|
|
|
|
body:
|
|
|
|
mappings:
|
|
|
|
company:
|
|
|
|
properties:
|
|
|
|
companyname:
|
|
|
|
type: string
|
|
|
|
employee:
|
|
|
|
type: nested
|
|
|
|
properties:
|
|
|
|
name:
|
|
|
|
type: string
|
|
|
|
|
|
|
|
|
|
|
|
- do:
|
|
|
|
indices.refresh: {}
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: nestedindex
|
|
|
|
type: ".percolator"
|
|
|
|
id: query
|
2014-02-20 09:59:35 -05:00
|
|
|
body: { "query": { "nested": { "path": "employee", "score_mode": "avg", "query": { "match": { "employee.name": { "query": "virginia potts", "operator": "and"} } } } } }
|
2014-02-11 07:46:54 -05:00
|
|
|
- do:
|
|
|
|
indices.refresh: {}
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
"Basic percolation tests on nested doc":
|
|
|
|
- do:
|
|
|
|
percolate:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
2014-02-20 11:45:49 -05:00
|
|
|
body: { "doc": { "companyname": "stark", "employee": [ { "name": "virginia stark"}, { "name": "tony potts"} ] } }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
- match: {'total': 0}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
percolate:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
2014-02-20 11:45:49 -05:00
|
|
|
body: { "doc": { "companyname": "stark", "employee": [ { "name": "virginia potts"}, { "name": "tony stark"} ] } }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
- match: {'total': 1}
|
|
|
|
|
|
|
|
---
|
|
|
|
"Percolate existing docs":
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
|
|
|
id: notmatching
|
2014-02-20 11:45:49 -05:00
|
|
|
body: { "companyname": "stark", "employee": [ { "name": "virginia stark"}, { "name": "tony potts"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
- do:
|
|
|
|
index:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
|
|
|
id: matching
|
2014-02-20 11:45:49 -05:00
|
|
|
body: { "companyname": "stark", "employee": [ { "name": "virginia potts"}, { "name": "tony stark"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
- do:
|
|
|
|
indices.refresh: {}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
percolate:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
|
|
|
id: notmatching
|
|
|
|
|
|
|
|
- match: {'total': 0}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
percolate:
|
|
|
|
index: nestedindex
|
|
|
|
type: company
|
|
|
|
id: matching
|
|
|
|
|
|
|
|
- match: {'total': 1}
|
|
|
|
|
|
|
|
---
|
|
|
|
"Test multi percolate":
|
|
|
|
|
|
|
|
|
|
|
|
- do:
|
|
|
|
mpercolate:
|
|
|
|
body:
|
|
|
|
- percolate: {"index": "nestedindex", "type": "company"}
|
2014-02-20 11:45:49 -05:00
|
|
|
- doc: { "companyname": "stark", "employee": [ { "name": "virginia stark"}, { "name": "tony potts"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
- percolate: {"index": "nestedindex", "type": "company"}
|
2014-02-20 11:45:49 -05:00
|
|
|
- doc: { "companyname": "stark", "employee": [ { "name": "virginia potts"}, { "name": "tony stark"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
- match: {'responses.0.total': 0}
|
|
|
|
- match: {'responses.1.total': 1}
|
|
|
|
|
|
|
|
- do:
|
|
|
|
mpercolate:
|
|
|
|
body:
|
|
|
|
- percolate: {"index": "nestedindex", "type": "company"}
|
2014-02-20 09:59:35 -05:00
|
|
|
- doc: { "companyname": "stark", "employee": [ { "name": "virginia potts"}, {"name": "tony stark"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
- percolate: {"index": "nestedindex", "type": "company"}
|
2014-02-20 11:45:49 -05:00
|
|
|
- doc: { "companyname": "stark", "employee": [ { "name": "virginia stark"}, { "name": "tony potts"} ] }
|
2014-02-11 07:46:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
- match: {'responses.0.total': 1}
|
|
|
|
- match: {'responses.1.total': 0}
|
|
|
|
|
|
|
|
|
|
|
|
|