OpenSearch/rest-api-spec/test/search/test_sig_terms.yaml

75 lines
1.6 KiB
YAML
Raw Normal View History

---
"Default index":
- do:
indices.create:
index: goodbad
body:
settings:
number_of_shards: "1"
- do:
index:
index: goodbad
type: doc
id: 1
body: { text: "good", class: "good" }
- do:
index:
index: goodbad
type: doc
id: 2
body: { text: "good", class: "good" }
- do:
index:
index: goodbad
type: doc
id: 3
body: { text: "bad", class: "bad" }
- do:
index:
index: goodbad
type: doc
id: 4
body: { text: "bad", class: "bad" }
- do:
index:
index: goodbad
type: doc
id: 5
body: { text: "good bad", class: "good" }
- do:
index:
index: goodbad
type: doc
id: 6
body: { text: "good bad", class: "bad" }
- do:
index:
index: goodbad
type: doc
id: 7
body: { text: "bad", class: "bad" }
- do:
indices.refresh:
index: [goodbad]
- do:
search:
index: goodbad
type: doc
- match: {hits.total: 7}
- do:
search:
index: goodbad
type: doc
body: {"aggs": {"class": {"terms": {"field": "class"},"aggs": {"sig_terms": {"significant_terms": {"field": "text"}}}}}}
- match: {aggregations.class.buckets.0.sig_terms.buckets.0.key: "bad"}
- match: {aggregations.class.buckets.1.sig_terms.buckets.0.key: "good"}