# Documentation Java API for Graph

**URL:** https://discuss.elastic.co/t/documentation-java-api-for-graph/75404
**Category:** Elasticsearch
**Tags:** elastic-stack-graph
**Created:** [February 16, 2017, 10:23pm UTC](https://discuss.elastic.co/t/documentation-java-api-for-graph/75404 "2017-02-16T22:23:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![David\_she](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_she/32/48792_2.png) [@David\_she](https://discuss.elastic.co/u/David_she)
#### Post date: [February 16, 2017, 10:23pm UTC](https://discuss.elastic.co/t/documentation-java-api-for-graph/75404/1 "2017-02-16T22:23:22Z")

</div>

Hi,  
Is there any documentation for using the Java API with graph. I've managed to do a basic search using the example kindly supplied by Mark - [Java API for Graph](https://discuss.elastic.co/t/java-api-for-graph/48076)

However I'd like to, for example, use multiple vertices and multiple connections rather than a single such as in the example. Also obviously having some doco would allow us to develop without having to ask for examples. If there is no doco released yet then a number of other examples would be ideal.  
Appreciated.

Just a heads up worked out how to do multi-field by simply using "QueryBuilders.multiMatchQuery" - Too obvious ☹ .  
However the documentation request still stands. 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: [February 17, 2017, 10:27am UTC](https://discuss.elastic.co/t/documentation-java-api-for-graph/75404/2 "2017-02-17T10:27:37Z")

</div>

> [@David\_she](#):
>
> Is there any documentation for using the Java API with graph

Being a REST-based service we provide a core description [1] don't tend to repeat the same API descriptions in detail for all of the various languages that we support (Java, Python, Perl, Ruby .net .....).

> [@David\_she](#):
>
> I'd like to, for example, use multiple vertices and multiple connections

In the link you provided there are examples of the APIs you need to call but they are only invoked once.  
Multiple vertices are added by calling `addVertexRequest` repeatedly for each of the fields you want to consider during each "hop".  
Multiple connections are added by calling `createNextHop` - this will effectively create the equivalent of nested `connections` objects in the JSON syntax. Each nested connections object represents a "hop" - taking the vertices discovered from results of the previous search and using them as criteria in a new search to discover new vertices.

Hope this helps.

[1] [Graph explore API | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/x-pack/current/graph-api-explore.html)

---

<div class="post-metadata">

### Author: ![David\_she](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_she/32/48792_2.png) [@David\_she](https://discuss.elastic.co/u/David_she)
#### Post date: [February 17, 2017, 10:23pm UTC](https://discuss.elastic.co/t/documentation-java-api-for-graph/75404/3 "2017-02-17T22:23:11Z")

</div>

Appreciated 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: [March 17, 2017, 10:23pm UTC](https://discuss.elastic.co/t/documentation-java-api-for-graph/75404/4 "2017-03-17T22:23:40Z")

</div>

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