# Graph Query across documents

**URL:** <https://discuss.elastic.co/t/graph-query-across-documents/230010>\
**Category:** Kibana\
**Tags:** elastic-stack-graph\
**Created:** [April 27, 2020, 6:57pm UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010 "2020-04-27T18:57:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![darshanmehta10](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darshanmehta10/32/67221_2.png) [@darshanmehta10](https://discuss.elastic.co/u/darshanmehta10)\
**Post date:** [April 27, 2020, 6:57pm UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010/1 "2020-04-27T18:57:13Z")

</div>

I have the data for Persons with companies (they are stakeholders in) in json format. I want to visualize the data in Kibana Graph in the format where there would be one person vertex with different edges leading to different company vertices he's a part of. I have tried the following schemas:

Schema 1:

```auto
    Person : {
      "name" : "Person-A",
      "company" : {
        "name" : "Company-A"
      }
    }

    Person : {
      "name" : "Person-A",
      "company" : {
        "name" : "Company-A"
      }
    }

```

This is basically one document per person per company. I then tried creating graph in Kibana with person.name and company.name (one person was associated with 15 companies, hence, I had 15 documents) but was not able to see anything.

I then came across [this](https://discuss.elastic.co/t/graph-query-across-multiple-documents/49185) thread and it suggested me to have a schema with one person and multiple companies. So, I changed the schema to this:

Schema 2:

```auto
    Person : {
      "name" : "Person-A",
      "companies" : [
          {
            "name" : "Company-A"
          },
          {
            "name" : "Company-B"
          }
      ]
    }

```

I now have 1 document with 15 elements in the array for the same person. I then tried plotting the graph again and Kibana still didn't show anything.

Am I missing something here? Do I need to try with different schema?

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [April 27, 2020, 8:36pm UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010/2 "2020-04-27T20:36:25Z")

</div>

cc @flash1293 , do you know (?)

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [April 28, 2020, 4:53am UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010/3 "2020-04-28T04:53:11Z")

</div>

By default Graph will only show connections between terms when they are confirmed by at least three documents. You can set this to one in Settings \> Advanced Settings in the Graph menu (I think the value is called Minimum doc count).

Also see [https://www.elastic.co/guide/en/kibana/current/graph-troubleshooting.html](https://www.elastic.co/guide/en/kibana/current/graph-troubleshooting.html) for other common problems

---

<div class="post-metadata">

**Author:** ![darshanmehta10](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darshanmehta10/32/67221_2.png) [@darshanmehta10](https://discuss.elastic.co/u/darshanmehta10)\
**Post date:** [May 8, 2020, 12:39pm UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010/4 "2020-05-08T12:39:27Z")

</div>

Thank you @thomasneirynck and @flash. This seems to have worked perfectly fine. Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 5, 2020, 12:39pm UTC](https://discuss.elastic.co/t/graph-query-across-documents/230010/5 "2020-06-05T12:39:36Z")

</div>

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