Search multiple documents

I have 2 indexes - People and Vehicles. Index "People" has a field "IsVisible" while index "Vehicles" does not have this property.

Now I want to search "Raymond" on these 2 indexes. However, the search only happens on "People" index for "IsVisible" field with value of true. Other records are irrelevant to this search. All records in "Vehicles" index are inclusive to the search.

I cannot use "Filter" on the search results as I need to return 100 records at all times.

I have tried all combination of "querystring", "match", "term", "bool" and cannot find the right query that giving the above condition.

Please advise on how to resolve this.

Regards

You should merge two indices into one index. You can do that outside of the elasticsearch or you can use enrich processor.

To use enrich processor you should have a correlation_id (eg. an id field that has in both indices).

image

Note: Performing full SQL-style joins in a distributed system like Elasticsearch is prohibitively expensive. Because of that the inner join query not exist in Elasticsearch.