ELK: Kibana graph chart & elastic-search mapping

I’d like to ask for advice about Kibana’s graph visualization & ElasticSearch mapping with join types.

I am having different entities, let say pets (let’s call them major entities) and their owners (minor entity).

I am inserting pets in PETS index and put owners in separate index of OWNERS. So some pets have a property that can be connected/join with the following (only one) owner.

Like this:

pets

{ 
  id: 1,
  name: 'Pikacho',
  ownerId: 1
}

owner

{ 
  id: 1,
  name: 'Rachel',
  petId: 1
}

Actually I am free to use every structure I want, even nested owner documents inside every pet. The real question is how to achieve the best case for graph data

Owners are really a separate entity and I don’t need them in the business logic of my app, but sometimes, as a user I’d like to check in Kibana’s UI via graph chart how many pets have one owner and so on.

enter image description here

So my question is: Are there any restrictions on data inserting (with.index method) via ElasticSearch driver for node.js, if I’d like to build a graph chart?

  • Should I create index via .create index and mark every field with correct mapping or I can just write them as usual and connect necessary field inside Kibana?
  • How to use join relation correctly in this case if I have to use it for graph chart?
  • ..and any other useful examples

My Elastic & Kibana versions are 7.16+ (current)