# Example documents

**URL:** https://discuss.elastic.co/t/example-documents/48726
**Category:** Kibana
**Tags:** elastic-stack-graph
**Created:** [April 28, 2016, 6:40pm UTC](https://discuss.elastic.co/t/example-documents/48726 "2016-04-28T18:40:55Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![reza\_sadoddin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reza_sadoddin/32/3437_2.png) [@reza\_sadoddin](https://discuss.elastic.co/u/reza_sadoddin)
#### Post date: [April 28, 2016, 6:40pm UTC](https://discuss.elastic.co/t/example-documents/48726/1 "2016-04-28T18:40:55Z")

</div>

The graph has the nice feature of "show example documents". However, I just can see the ID's of documents. No information is shown for other fields of documents. Does that mean the documents should be returned by IDs in Kibana or ES by another query or I am missing something?

Thanks,

---

<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: [April 28, 2016, 10:10pm UTC](https://discuss.elastic.co/t/example-documents/48726/2 "2016-04-28T22:10:44Z")

</div>

The "ID" header should be a drop-down letting you select from a choice of other fields.

---

<div class="post-metadata">

### Author: ![reza\_sadoddin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reza_sadoddin/32/3437_2.png) [@reza\_sadoddin](https://discuss.elastic.co/u/reza_sadoddin)
#### Post date: [April 28, 2016, 10:59pm UTC](https://discuss.elastic.co/t/example-documents/48726/3 "2016-04-28T22:59:12Z")

</div>

I see the drop-downs and I tried to switch to other fields, but nothing is shown after selecting other fields. I am sure the fields have correct values based on the query I run through ES.

---

<div class="post-metadata">

### Author: ![reza\_sadoddin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reza_sadoddin/32/3437_2.png) [@reza\_sadoddin](https://discuss.elastic.co/u/reza_sadoddin)
#### Post date: [April 28, 2016, 10:59pm UTC](https://discuss.elastic.co/t/example-documents/48726/4 "2016-04-28T22:59:52Z")

</div>

This is observed on Chrome running on Windows.

---

<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: [April 29, 2016, 6:41am UTC](https://discuss.elastic.co/t/example-documents/48726/5 "2016-04-29T06:41:46Z")

</div>

One issue is that the list of the fields in the drop down are those defined in the mapping, some of which are in the index but not present in the original \_source json. These sorts of fields cannot be shown. To help debug this try open the dev tools in Chrome, switch to the "Network" tab then hit the graph UI's "Show example docs" button. In the Chrome dev tools panel you should see a network call to "getExampleDocs" and can see the raw JSON response including the hits. This should help reveal what content should be displayable. However anything but simple root-level fields (e.g. nested arrays of objects) might have some challenges.

Going forward I want to replace this primitive doc viewer with the ability to drill down using any pre-saved Kibana visualisation (tables, maps, timelines..)

---

<div class="post-metadata">

### Author: ![astanway](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@astanway](https://discuss.elastic.co/u/astanway)
#### Post date: [May 25, 2016, 5:18pm UTC](https://discuss.elastic.co/t/example-documents/48726/6 "2016-05-25T17:18:56Z")

</div>

Following up - I would like to return _all_ documents reflected in each edge - is there a REST query for this?

---

<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: [May 26, 2016, 8:09am UTC](https://discuss.elastic.co/t/example-documents/48726/7 "2016-05-26T08:09:46Z")

</div>

> [@astanway](#):
>
> is there a REST query for this?

Yes. First a tip to get hold of the query JSON - when you have some vertices selected in the workspace perform the following steps:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/2/285e266f10488bfb1fcfeb678330b730a747f3b0.jpg)

Having got the query pass that as the body in a search request as described here: [Query DSL | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/query-dsl-intro.html)

---

<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: [May 26, 2016, 9:21am UTC](https://discuss.elastic.co/t/example-documents/48726/8 "2016-05-26T09:21:10Z")

</div>

Actually, one extra tip...  
Having copied the query body using the approach in my last comment you can paste the query JSON into other Kibana text inputs to filter dashboards or visualizations as shown below:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/9/980f9d0a6a6ae68658c84facbaa1989ecbde7f03.jpg)

---

<div class="post-metadata">

### Author: ![astanway](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@astanway](https://discuss.elastic.co/u/astanway)
#### Post date: [May 26, 2016, 3:33pm UTC](https://discuss.elastic.co/t/example-documents/48726/9 "2016-05-26T15:33:51Z")

</div>

Ok - thanks. And is this functionally equivalent to using the getExampleDocs endpoint as described above, using a `top_hits` size of infinity?

---

<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: [May 26, 2016, 3:44pm UTC](https://discuss.elastic.co/t/example-documents/48726/10 "2016-05-26T15:44:06Z")

</div>

> [@astanway](#):
>
> is this functionally equivalent to using the getExampleDocs endpoint as described above, using a top\_hits size of infinity?

The pie chart is (here it is showing aggregated doc counts for 2 terms "male" and "female").

To extract very large amounts of individual docs you need to look at this API: [Scroll | Elasticsearch: The Definitive Guide [2.x] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/scroll.html)

---

<div class="post-metadata">

### Author: ![astanway](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@astanway](https://discuss.elastic.co/u/astanway)
#### Post date: [May 26, 2016, 3:48pm UTC](https://discuss.elastic.co/t/example-documents/48726/11 "2016-05-26T15:48:15Z")

</div>

Hmm - when I query `api/graph/getExampleDocs` with this:

```auto
json: {
      index:"jdbc",
      body: {
          query:{ 
              bool: {
                  should: [{
                      term: {
                              body: "[ORIGINAL GRAPH QUERY]"
                          }
                      }
                  ]
              }
          },
          size: 0,
          aggs: {
              sample: {
                  sampler: {},
                  aggs: {
                  topHits: {
                      top_hits: {
                              size:10000
                          }
                      }
                  }
              }
          }
      }
    }

```

(which is the same request that goes out when I check the network tab, with the addition of the higher `top_hits` value) I get the actual documents. What are these then?

---

<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: [May 26, 2016, 3:53pm UTC](https://discuss.elastic.co/t/example-documents/48726/12 "2016-05-26T15:53:03Z")

</div>

> [@astanway](#):
>
> What are these then?

A way of getting 1000 docs but not an advisable way of getting 1,000,0000,000 docs.

---

<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:43pm UTC](https://discuss.elastic.co/t/example-documents/48726/13 "2017-07-06T13:43:24Z")

</div>


