Creating another search from the value of a field in an initial search?

If I initially search my db and get back 3 documents.

Doc 1:
field_a : user1_id

Doc 2:
field_a : user1_id

Doc 3:
field_a : user2_id

I then want to search using the value 'user2_id'

Currently I achieve this with a search that gives me the 3 docs, take the
value 'user2_id' and research with a must not filter. Which is adequate but
I feel like I have all the information to do it in one.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hiya

On Thu, 2013-03-21 at 07:04 -0700, Teddy777 wrote:

If I initially search my db and get back 3 documents.

Doc 1:
field_a : user1_id

Doc 2:
field_a : user1_id

Doc 3:
field_a : user2_id

I then want to search using the value 'user2_id'

Currently I achieve this with a search that gives me the 3 docs, take
the value 'user2_id' and research with a must not filter. Which is
adequate but I feel like I have all the information to do it in one.

Essentially you are wanting to do a join. Elasticsearch doesn't support
joins per se. You could look at using parent/child, which is a form of
join, but it may come with more complexity than you need.

Doing the above in two queries is probably the best way of achieving
what you need

clint

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

HI, yeah ok thanks for that.
On Thursday, 21 March 2013 14:04:23 UTC, Teddy777 wrote:

If I initially search my db and get back 3 documents.

Doc 1:
field_a : user1_id

Doc 2:
field_a : user1_id

Doc 3:
field_a : user2_id

I then want to search using the value 'user2_id'

Currently I achieve this with a search that gives me the 3 docs, take the
value 'user2_id' and research with a must not filter. Which is adequate but
I feel like I have all the information to do it in one.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.