Hello there,
I am a beginner in Elasticsearch and I have been reading about how to merge 2 indexes based on two different names columns with the same values. I understand the NoSQL performance of elastic but still having a hard time performing the queries. For instance I have the following:
Index_1: Laptops-id-area
{
"_index": "laptops-demo",
"_id": "1",
"_score": 1,
"_source": {
"id": 1,
"name": "marketing"
}
},
{
"_index": "laptops-demo",
"_id": "2",
"_score": 1,
"_source": {
"id": 2,
"name": "Finance"
}
},
{
"_index": "laptops-demo",
"_id": "3",
"_score": 1,
"_source": {
"id": 3,
"name": "Sales"
}
Index_2: laptops
{
"_index": "laptops",
"_id": "1",
"_score": 1,
"_source": {
"id": 1,
"name": "lenovo",
"description": "8GB 2022",
"laptop_id": 3
}
},
{
"_index": "laptops",
"_id": "2",
"_score": 1,
"_source": {
"id": 2,
"name": "Vaio",
"description": "32GB 2019",
"laptop_id": 2
}
},
{
"_index": "laptops",
"_id": "3",
"_score": 1,
"_source": {
"id": 3,
"name": "Dell",
"description": "Intel core i7 64GB 2021",
"laptop_id": 1
}
Since the fields index_1.id == index_2.laptop_id I would like to output a mapping of the index_2 fields with the name of index_1.name. Output:
"_id", "_score", "name", "description", "laptop_id", "name from index 1"
Could you please be so gentle in directing me in the right coding script? Thank you in advance