Defining a mapping for Join (ES 6.2.2) - CURL

What is the best mapping for a join between two documents?

Actually, i'm creating a data warehouse to stock my postgres data:

table: customer
column			| type
---------------------------
id_customer 	| integer
name            | varchar
email           | varchar
enabled 		| char

table: order
column			| type
---------------------------
id_order 		| integer
id_customer 	| integer (foreign key from customer)
value 			| numeric
finishied 		| char

How i create a mapping to this both documents?
Because i will need search in orders when the customer (father) has the property enabled equal to 'Y'.

Or what about a document like:

PUT orders/doc/1
{
  "value": 1,
  "finishied": true,
  "customer": {
    "name": "Joe Smith",
    "email": "joe@foo.bar",
    "enabled": true
  }
}

Hi @dadoonet.

After a customer update will be necessary reindex all the orders, and some customer can have a huge quantity of orders.

After a customer update will be necessary reindex all the orders

Yes.

and some customer can have a huge quantity of orders.

How many? Like more than 1 million orders?
How long would that take?

I mean that for sure you have to pay a price at some point.

Do you want to pay the price at index time? Or at search time?

1 Like

Thanks @dadoonet, your observation make all sense.

Is best pay the price at index time, whereas the client change occurs less frequently than orders.

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