I have solved with RegEx GET /my_index/my_type/_search { "_source": false, "query": { "bool": { ... } }, "aggs": { "group": { "nested": { "path": "my_path" }, "aggs": { "path_id": { "terms": { "field": "my_path.id", "lang": "groovy", "script": "def *myVar* = (_value.split('\\\\.').findIndexOf { it == '3238175' }+1); *myVar* + '/' + _value; ", "include": "*[1-4]*/.*", "size": 0 } } } } } }
-- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d943e0e8-066c-4db0-89e0-75d8fbaf34e5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.