How do I combine 2 index data in elasticsearch?
Example;
1.index data = {appId,name,clasId}
2.index data={clasId,name,description}
1.index via clasId 2.index class name how do I pull ?
How do I combine 2 index data in elasticsearch?
Example;
1.index data = {appId,name,clasId}
2.index data={clasId,name,description}
1.index via clasId 2.index class name how do I pull ?
this page not working
https://www.elastic.co/elasticon/2015/sf/building-entity-centric-indexes
I could not see the solution.
How to merge two indexes based on common field in Elasticsearch?
screen shot of the solution here
I do not fully understand the solution.
It requires writing custom code that uses those APIs.
The exact solution would depend on your preferred choice of programming language.
Can't this process be done in elasticsearch?
It requires writing custom code that uses those APIs.
is there any code snippet that does the operation you mentioned above?
This is a rough outline for merging 2 indices into a third using python https://gist.github.com/markharwood/7bca8a15a6b0c36b6b412971ee192037
POST test1/_doc/1
{
"Id":1,
"name":"fooName",
"categoryId":1
}
POST category/_doc/1
{
"Id":1,
"name":"one",
"address":"fooAddress"
}
here is categoryId into test1,Id into category ,this fields join data, both two field musn't categoryId,
JOİN FİELDS:
test1 :categoryId
category:Id
RESULT:
test1 or other creating third index
{
"Id":1,
"name":"fooName",
"categoryId":1,
"name":"one"
}
If you don't have a common field name you would need to use a script to retrieve the sort value depending on which index the document came from eg.
GET test1,test2/_search
{
"sort":{
"_script" : {
"type" : "string",
"script" : {
"lang": "painless",
"source": "if (doc.containsKey('catId')) return doc['catId']; return doc['myId'] ;"
},
"order" : "asc"
}
}
}
You'd have to modify my Python code which fuses the documents accordingly because that assumes a common field name.
Can you make join code running in elastic search?
At some point the database ends and your application code begins.
I’ve already given you the pointers required to do this - if you can’t code that’s fine but we are not here to do that for you.
thank you for everything ,
For the first time I have been dealing with nosql structure.
I would really appreciate it if you really help.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.