Hi
I am a beginner in using elasticsearch, and I have a few questions on how best to store the data in elasticsearch with respect to the maximum search speed.
In the relational database, I have the following three entities (tables) stored in binding:
car brand 1: n car model 1: n car type
example:
Brand Model Type
MERCEDES-BENZ E-CLASS COUPE (C123) 280 CE
MERCEDES-BENZ E-CLASS COUPE (C123) 300 C Turbo-D (123.153)
MERCEDES-BENZ E-CLASS COUPE (C123) 280 C
MERCEDES-BENZ E-CLASS KOMBI ESTATE (S123) 200 T (123.280)
MERCEDES-BENZ E-CLASS KOMBI ESTATE (S123) 200 T
MERCEDES-BENZ E-CLASS COUPE (C124) 230 CE (124.043)
MERCEDES-BENZ E-CLASS COUPE (C124) 300 CE
MERCEDES-BENZ E-CLASS COUPE (C124) 300 CE-24 (124.051)
And last entity (table) product is binding n:n to car type.
How best to store this data in elasticsearch? Main the task is to find the product over car.
I have the following variants:
- four separate indexes (car brand, car model, car type, product + car type), but in this case I don't know how to link indexes and create a simple query over all indexes
- single index product + with tree separated column, data in columns will be separated over comma
- single index product + with single nested field over this structure:
"car": [
{
"brand": "Mercedes",
"model": [
{
"name": "E-CLASS COUPE (C123)",
"cartype": [
"280 CE",
"300 C Turbo-D (123.153)"
]
},
{
"name": "E-CLASS KOMBI ESTATE (S123)",
"cartype": [
"200 T (123.280)",
"200 T"
]
}
]
},
{
"brand": "BMW" …. Next cars
}
]
}
but I also have no idea how to create a query through this structure.
The following question. How to set the tokenizer, for example, to find the product, if the input string is: “Mercedes coupe 300 turbo”?
Thank you for any answer
Jaroslav