I'm currently using elasticsearch for an intranet which main goal is to
manage users and invoices.
I created an index for the users with their invoices as an array of objects
containing the invoices informations.
I'm able to search for users just fine, but I wonder how I am supposed to
search in the invoices... for example, if I want to search for all invoices
with values between 0 and 500 and which user name is "frank" (lucene
"name:frank AND invoices.value:[0 TO 500]"
This "works" fine in the sense that it returns all users named frank that
have at least one invoice with value between 0 and 500, but in what is
returned it also return the other invoices that are over 500 for those
Is there a way to make it filter the list of invoices so only the ones
matching are returned?
Or maybe I should create two indexes, one for the users and one for the
invoices? But doens't that duplicate a lot of data?
Or maybe there is a way to represent/query relational data in elasticsearch
by indexing it differently?