Using inner_hits inside aggregation script

in aggs, can we query(using script) the inner_hits instead of _source?
{
"sort": [
{
"date": {
"order": "desc"
},
"_score": {}
}
],
"_source": ["user_id", "topic", "date", "_id"],
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"match": {
"user_id": "ctAAzCHSAuurshFch"
}
},
{
"match": {
"user_id": "MuyrXaniHQ2qD7zrw"
}
}
]
}
},
{
"range": {
"date": {
"gte": "now-20d",
"lte": "now"
}
}
},
{
"nested": {
"path": "transcription",
"query": {
"bool": {
"must": [
{
"match": {
"transcription.text": "this is it"
}
}
],
"filter": {
"bool": {
"must": [
{
"match": {
"transcription.speaker": "Rep"
}
}
]
}
}
}
},
"inner_hits": {
"sort": [
{
"transcription.conv_no": {
"order": "asc"
}
}
],
"highlight": {
"pre_tags": [""],
"post_tags": [""],
"fields": {
"transcription.text": {
"fragment_size": 2000
}
}
}
}
}
}
]
}
},
"aggs" : {
"segments" : {
"date_histogram" : {
"field" : "date",
"interval" : "week",
"format" : "yyyy-MM-dd"
}
},
"avg_grade" : {
"stats" : {
"script" : {
"inline" : "if(params.inner_hits != null) { return 5} else {return -1}"
}
}
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.