Storing all term positions in an array?

This is a part of a groovy code that I wrote to get term positions:

for (pair in pairs) { // pairs is an array of pairs of terms
def (value1, value2) = pair.tokenize(' ');
def pos_w1;
def pos_w2;
for (pos in _index["data"].get(value1, _POSITIONS)) {
pos_w1 = pos.position;
}
for (pos in _index["data"].get(value2, _POSITIONS)) {
pos_w2 = pos.position;
}}

I want it to work this way:

pairs = ['word1 word2', 'word3 word4']
iteration 1:
word1 : [2, 3]
word2 : [6, 7, 8, 13]
word1 : [45, 64]
word2 : [46, 67, 87, 90]

I want to create an array of positions of value1 and one array of positions
of value1. How can I do that?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/484bde40-e692-454b-a1ad-20966b49974a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.