# Graph API not working

**URL:** https://discuss.elastic.co/t/graph-api-not-working/73797
**Category:** Elasticsearch
**Tags:** elastic-stack-graph
**Created:** [February 3, 2017, 6:33am UTC](https://discuss.elastic.co/t/graph-api-not-working/73797 "2017-02-03T06:33:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ahr12](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@ahr12](https://discuss.elastic.co/u/ahr12)
#### Post date: [February 3, 2017, 6:33am UTC](https://discuss.elastic.co/t/graph-api-not-working/73797/1 "2017-02-03T06:33:00Z")

</div>

I use graph Java API. but I am getting the NullPointerException Errors.  
This is my code -\>  
package org.formcept.orient;  
//import java.net.InetAddress;  
import java.net.InetAddress;  
import java.util.Collection;

import org.elasticsearch.client.transport.TransportClient;  
import org.elasticsearch.common.settings.Settings;  
import org.elasticsearch.common.transport.InetSocketTransportAddress;  
import org.elasticsearch.graph.action.GraphExploreAction;  
import org.elasticsearch.graph.action.GraphExploreRequestBuilder;  
import org.elasticsearch.graph.action.GraphExploreResponse;  
import org.elasticsearch.graph.action.Hop;  
import org.elasticsearch.graph.action.Vertex;  
import org.elasticsearch.index.query.QueryBuilders;  
import org.elasticsearch.transport.client.PreBuiltTransportClient;

/\*\*

- Demo graph client - find elastic meetup attendees and what other meetup groups they frequent  
\*/  
public class EsGraph {

}

I am getting following error -:

Exception in thread "main" java.lang.NullPointerException  
at org.elasticsearch.client.transport.TransportProxyClient.lambda$execute$0(TransportProxyClient.java:59)  
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:231)  
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)  
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:345)  
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)  
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)  
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)  
at org.formcept.orient.EsGraph.main(EsGraph.java:42)

---

<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 3, 2017, 9:48am UTC](https://discuss.elastic.co/t/graph-api-not-working/73797/2 "2017-02-03T09:48:59Z")

</div>

Let's start by making sure your data is at least there using the REST API. Can you provide the results of these calls:

```
curl -XGET "http://localhost:9200/meetuprsvps/_search" -d'
{
  "query": {
	"term": {
	  "_all": "elasticsearch"
	}
  }
}'

curl -XGET "http://localhost:9200/meetuprsvps/_xpack/_graph/_explore" -d'
{
  "query": {
	"term": {
	  "_all": "elasticsearch"
	}
  },
  "controls": {
	"use_significance": true,
	"sample_size": 2000
  },
  "vertices": [
	{
	  "field": "member_id"
	}
  ],
  "connections": {
	"vertices": [
	  {
		"field": "group_id"
	  }
	]
  }
}'

```

The second request is the equivalent of the Java example and the first is just to confirm you have an index with some data.

---

<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 3, 2017, 11:17am UTC](https://discuss.elastic.co/t/graph-api-not-working/73797/3 "2017-02-03T11:17:05Z")

</div>

A full "Hello, World" example that is working for me on the latest 5.2 release: [https://gist.github.com/markharwood/f9e955f52908129ef364446cfec0a65e](https://gist.github.com/markharwood/f9e955f52908129ef364446cfec0a65e)

---

<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 3, 2017, 11:17am UTC](https://discuss.elastic.co/t/graph-api-not-working/73797/4 "2017-03-03T11:17:45Z")

</div>

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