Terms lookup mechanism - in reverse?

Hi

My understanding of the terms lookup mechanism is that you can provide a term and then as a result of that surface the documents that match a particular term name. So for example if you had an User and a Transaction, you could lookup the user's name and surface his transactions.

However, if I wanted to surface all user's names across all transactions, I'm assuming that wouldn't be possible with this mechanism. i.e. a table that has both the user name and its transactions.

From reading the docs, I'm assuming that's where nesting/child-parent relationships comes in.

Thanks
Chris

Terms lookup is just fetching a list of terms from a static document, and then using those values as the list of terms to filter by. So it isn't really any different from providing the list yourself, except it resides inside a document which can sometimes be easier to deal with (for "persistent" lists, long lists, etc).

If you just want a list of all users that had a transaction, you could do something like a terms aggregation on the username field... that'll give you a list of distinct terms (usernames) in the index.

Thank @polyfractal. What I was after is something like:

| username | transaction |
| u1 | t1 |
| u2 | t2 |
| u1 | t3 |

But what you say confirms my understanding.

Cheers
Chris

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