Joining

Hello,

I am learning to use Elasticsearch. I have a little question. I created two index, one with "dateofbirth" and "names" of peoples and the second index is with "order" and names so i used system of parent/child but I am not sure if what I did is good because when I try it's not really the result what I that I thought.
My code looks like this.

POST person/delivery
{
  "yearOfBirth":[1995, 2001], 
   "mappings": {
     "_doc": {
       "properties": {
          "my_join_field": { 
            "names": ["John", "Phil"] 
         }
       }
     }
  }
}

POST /business/delivery
{
  "order": "Hello how are you",
  "my_join_field": {
     "name" : "names",
     "parent": "zXSREGQBvDb6z7K3nBMu"
  }
}

I thank you in advance for your help

Great!

I'd not start learning Elasticsearch by doing relations. The best thing to do with a search engine is to denormalize your data. Like indexing something like this instead:

POST /business/delivery
{
  "order": "Hello how are you",
  "person": {
     "name" : "John"
  }
}
1 Like

thank you so much

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