Elasticsearch "OR" condition query

Hi!
I am trying to query an index with two different document fieldsets.
to be more specific, I am trying to query all documents where field1 is equal to field2 but field1 and field2 will never exists in the same document.
my achievment is to query both types of document where my "KEY" is the field's value.
is it possible?

doc_type1:

event: 1234
name: new_events

doc_type2:

event_id: 1234
 name: events

i would like to recive an output of both types of documents!

Just to make sure I properly understand. You are basically trying to query for event:1234 or event_id:1234? This can be done with a boolean query.

If you do not know the value of 1234 upfront, then you may want to rethink your index strategy/data modeling strategy. Another thing to look at is the join field type

thank you for responding so quickly,
the problem is that I don't know the value of 1234 upfront.
join field type is not the solution i am looking for,
you may use it only once per index...

any other suggestions?

Then denormalization might be the way to go... one last straw may be taking a look at transforms, but I am not sure if that fits your use-case - still worth checking it out.

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