# Explore api for related documents

**URL:** <https://discuss.elastic.co/t/explore-api-for-related-documents/57616>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-graph\
**Created:** [August 9, 2016, 5:01pm UTC](https://discuss.elastic.co/t/explore-api-for-related-documents/57616 "2016-08-09T17:01:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssawan786](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@ssawan786](https://discuss.elastic.co/u/ssawan786)\
**Post date:** [August 9, 2016, 5:01pm UTC](https://discuss.elastic.co/t/explore-api-for-related-documents/57616/1 "2016-08-09T17:01:20Z")

</div>

The schema below relates spanID and parentSpanID across multiple documents. I am using following graph API to return me at least five connections but is does not return anything.

looking for help in setting up the correct query.  
Note: I want to get the elementID for every vertex as well.

```
  {
      "parentSpanID": "0",
      "spanID": "1470760972860",
      "elementID": "578b07c6ee34dc00017f980f",
  },
  {
      "parentSpanID": "1470760972860",
      "spanID": "1470760972870",
      "elementID": "578b07c6ee34dc00017f980g",
  },
  {
      "parentSpanID": "1470760972870",
      "spanID": "1470760972880",
      "elementID": "578b07c6ee34dc00017f980h",
  }
  ... so on

```

POST btx-tenant1\_2016-08-08/Span/\_graph/explore  
{  
"query": {  
"term": {  
"parentSpanID": 0  
}  
},  
"vertices": [  
{  
"field": "spanID"  
}  
],  
"connections": {  
"vertices": [  
{  
"field": "parentSpanID"  
}  
]  
}  
}

{  
"took": 0,  
"timed\_out": false,  
"failures": [],  
"vertices": [],  
"connections": []  
}

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 9, 2016, 5:21pm UTC](https://discuss.elastic.co/t/explore-api-for-related-documents/57616/2 "2016-08-09T17:21:16Z")

</div>

The API troubleshooting guide has a section on this with some settings to change. These settings can be found in the user interface when you click on the cog icon.

[https://www.elastic.co/guide/en/graph/current/graph-troubleshooting.html#\_why\_are\_results\_missing](https://www.elastic.co/guide/en/graph/current/graph-troubleshooting.html#_why_are_results_missing)

Cheers  
Mark

---

<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:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/explore-api-for-related-documents/57616/3 "2017-07-06T13:42:47Z")

</div>


