How can I query Elasticsearch to join or correlate data between two indices that have different field names but contain the same values?

1.I have two indices, index1 and index2, and they have different field names but the values in these fields are the same. For example:

  • index1 has a field named name1 with values like "value1", "value2", etc.
  • index2 has a field named name2 with values like "value1", "value2", etc.

How can I write a query in Elasticsearch to effectively join or correlate the data between these two indices based on the matching values in name1 and name2?

Note: writing above queries is it possible to display in Kibana dashboard..?
i mean shell we create dashboards based up the query..?

Is this something you're looking for

POST index1/_doc
{
  "name1":["value1","value2"]
}

POST index2/_doc
{
  "name2":["value1","value2"]
}


GET index1,index2/_search
{
  "query": {
    "multi_match": {
      "query": "value1",
      "fields": ["name1","name2"]
    }
  }
}
2 Likes

Shall I integrate above query in dashboard table ,is there document avaaible ..?

I need to use above query fetch the results and shown in table view