# Get extra fields at \`xpack\` vertices

**URL:** <https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457>\
**Category:** Elasticsearch\
**Created:** [November 12, 2019, 7:43am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457 "2019-11-12T07:43:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbenatia](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dbenatia](https://discuss.elastic.co/u/dbenatia)\
**Post date:** [November 12, 2019, 7:43am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/1 "2019-11-12T07:43:30Z")

</div>

Hello all , i am using elasticsearch v5.6 with an "xpack" license, i am doing a request to `//_xpack/_graph/_explore` as shown in the docs.  
the response is `vertices` and `connections` as expected. is there any way to add an "extra" field except the one pointed out in  
`"vertices": [{ "field": "field1" }]`

???

---

<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:** [November 12, 2019, 10:56am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/2 "2019-11-12T10:56:49Z")

</div>

Hi @dbenatia

> [@dbenatia](#):
>
> is there any way to add an "extra" field except the one pointed out in

No, the field choice used here is to uniquely identify each of the vertices in the graph.  
The graph API is primarily about _discovery_ of the IDs of interest. To fill-in details about the entities behind these IDs you can then use a search and the aggregations framework to gather as much or as little as you need.  
For example, having discovered email addresses `mitch`, `chris` and `kay` are connected you might then want to find out about when communications occurred. You can issue a follow-up query using the `adjacency_matrix` aggregation with a date\_histogram aggregation to get a break down of when each of these email addresses interacted as follows:

```
{
	"size": 0,
	"query": {
		"terms": {
			"participants": ["kay@enron.com", "mitch@enron.com", "chris@enron.com"]
		}
	},
	"aggs": {
		"date": {
			"date_histogram": {
				"field": "Date",
				"interval": "1d"
			},
			"aggs": {
				"matrix": {
					"adjacency_matrix": {
						"filters": {
							"mitch": {
								"term": {
									"participants": "mitch@enron.com"
								}
							},
							"chris": {
								"term": {
									"participants": "chris@enron.com"
								}
							},
							"kay": {
								"term": {
									"participants": "kay@enron.com"
								}
							}
						}
					}
				}
			}
		}
	}
}

```

This would give you the all the data to draw out details of interactions over time like this:

 ![Kibana](https://us1.discourse-cdn.com/elastic/original/3X/9/8/98e3b43cc468930cd7872bcaf710cf1749177aa5.png)

If this were financial data you could also throw in a `sum` aggregation to size circles/lines by the amounts of money transferred.

In your case if you simply want to pull in some reference data like a label to go along with a vertices' ID number you might want to use a `terms` aggregation in a follow-up query. To avoid doing this in Graph and elsewhere I often find it is useful to index single terms that are a combination of an ID and a label e.g `"John Smith [64374354]"`. This means that we have uniquely identified entities with readable labels that are useful in Kibana.

---

<div class="post-metadata">

**Author:** ![dbenatia](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dbenatia](https://discuss.elastic.co/u/dbenatia)\
**Post date:** [November 13, 2019, 8:40am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/3 "2019-11-13T08:40:49Z")

</div>

thank you for the quick response, is there a detailed doc on `aggs` ?

---

<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:** [November 13, 2019, 9:28am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/4 "2019-11-13T09:28:57Z")

</div>

The [api docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html) have all the detail.  
This [blog](https://www.elastic.co/blog/intro-to-aggregations) offers some background

---

<div class="post-metadata">

**Author:** ![dbenatia](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@dbenatia](https://discuss.elastic.co/u/dbenatia)\
**Post date:** [November 13, 2019, 10:19am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/5 "2019-11-13T10:19:26Z")

</div>

Alright, thank you for the 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:** [December 11, 2019, 10:19am UTC](https://discuss.elastic.co/t/get-extra-fields-at-xpack-vertices/207457/6 "2019-12-11T10:19:27Z")

</div>

Closed on December 11, 2019, 10:19am UTC

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