Search in two indexes

I have two indices.

  1. Customer: List of all customers, their internal identifier (id) and their name (name);
  2. Order: List of all purchases made, with purchase date (order_date), customer id (customer.id) and name (customer.name).

Is it possible with Elasticsearch to search for all customers in the Customer index that do not have purchases in the Order index?

If a customer has never made a purchase they will never have data in the Order index, but it should still appear in search results.

This is a join, so no.

You can query for each unique customer ID/name that exists in the order index. You'd then need to compare that to the customer index to see what's missing.

This transform approach could be another option, while there are some tradeoffs.

2 Likes

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