mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
add a rest test for this that seems to work, fix the documentation. thanks @s1monw
This commit is contained in:
parent
6b4e47bf96
commit
c5532d3df0
@ -443,7 +443,10 @@ Generating the terms using a script:
|
|||||||
"aggs" : {
|
"aggs" : {
|
||||||
"genders" : {
|
"genders" : {
|
||||||
"terms" : {
|
"terms" : {
|
||||||
"script" : "doc['gender'].value"
|
"script" : {
|
||||||
|
"inline": "doc['gender'].value"
|
||||||
|
"lang": "painless"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,7 +485,10 @@ TIP: for indexed scripts replace the `file` parameter with an `id` parameter.
|
|||||||
"genders" : {
|
"genders" : {
|
||||||
"terms" : {
|
"terms" : {
|
||||||
"field" : "gender",
|
"field" : "gender",
|
||||||
"script" : "'Gender: ' +_value"
|
"script" : {
|
||||||
|
"inline" : "'Gender: ' +_value"
|
||||||
|
"lang" : "painless"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,3 +363,33 @@
|
|||||||
|
|
||||||
- match: { hits.total: 1 }
|
- match: { hits.total: 1 }
|
||||||
- match: { hits.hits.0.fields.foobar.0: 1 }
|
- match: { hits.hits.0.fields.foobar.0: 1 }
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
"Agg _value":
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { "dummy_field": 1 }
|
||||||
|
- do:
|
||||||
|
indices.refresh: {}
|
||||||
|
|
||||||
|
|
||||||
|
- do:
|
||||||
|
index: test
|
||||||
|
search:
|
||||||
|
body:
|
||||||
|
aggs:
|
||||||
|
value_agg:
|
||||||
|
terms:
|
||||||
|
field: dummy_field
|
||||||
|
script:
|
||||||
|
lang: painless
|
||||||
|
inline: "_value + 1"
|
||||||
|
|
||||||
|
- match: { hits.total: 1 }
|
||||||
|
- match: { hits.hits.0._score: 1.0 }
|
||||||
|
- match: { aggregations.value_agg.buckets.0.key: 2 }
|
||||||
|
- match: { aggregations.value_agg.buckets.0.doc_count: 1 }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user