# Elastic search Nginx

**URL:** <https://discuss.elastic.co/t/elastic-search-nginx/90984>\
**Category:** Elasticsearch\
**Created:** [June 27, 2017, 2:46pm UTC](https://discuss.elastic.co/t/elastic-search-nginx/90984 "2017-06-27T14:46:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdou](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@abdou](https://discuss.elastic.co/u/abdou)\
**Post date:** [June 27, 2017, 2:46pm UTC](https://discuss.elastic.co/t/elastic-search-nginx/90984/1 "2017-06-27T14:46:41Z")

</div>

Hello guys,

I have some difficulties to use Elastic Search with NGINX in a VM.

I used elastic search 2.3 in a VM and i use NGINX to filter and redirect the request.  
VM port forwarding  
8887 -\> 8887  
8889 -\> 8889  
Then I use NGINX to redirect from 888X to 9X000  
8887 =\> 8887 =\> 9300  
8889 =\> 8889 =\> 9200

I tried to create a java program that will query, i use the example from the documentation ([https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.3/java-docs-get.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.3/java-docs-get.html))

```
Settings settings = Settings.settingsBuilder()
                    //.put("name","Jigsaw") //Jigsaw
                    // .put("node.name","Jigsaw") //Jigsaw
                    .put("cluster.name","demo-cluster") //demo-cluster cluster.name
                    .put("client.transport.sniff", false)
                    //.put("client.transport.ping_timeout", 20, TimeUnit.SECONDS)
                    .put("repositories.enabled", false)
                    //.put("client.transport.ping_timeout", "5s")
                    //.put("network.bind_host", "0")
                    //.put("host","localhost")
                    .build();

            int portInt = Integer.parseInt(port) ;
            System.out.println("Port utilisé : " + portInt);

            client = TransportClient.builder()
                    .settings(settings).build()
                    .addTransportAddress(new InetSocketTransportAddress( InetAddress.getByName("localhost") , portInt ) ); // 9300 InetAddress.getLocalHost()

            /// Refer: https://discuss.elastic.co/t/elasticsearch-in-java-transportclient-nonodeavailableexception-none-of-the-configured-nodesare-available/34452

            GetResponse response = client.prepareGet("csv", "voiture", "AVzRDfZZadPcOu3hasyv").get();
            Map<String,GetField> listeField = response.getFields();

            for (Map.Entry<String,GetField> entry : listeField.entrySet()) {
                System.out.println( entry.getKey());
            }

```

When I run my program from inside the VM , it works fine.  
But when I run it from my computer I always have the same error :

* * *

Jun 27, 2017 4:41:46 PM org.elasticsearch.plugins.PluginsService   
INFO: [Bushmaster] modules [], plugins [], sites []  
Jun 27, 2017 4:41:48 PM org.elasticsearch.transport.netty.NettyTransport exceptionCaught  
WARNING: [Bushmaster] exception caught on transport layer [[id: 0x1dee0bb2, /127.0.0.1:65320 =\> localhost/127.0.0.1:8887]], closing connection  
java.io.StreamCorruptedException: invalid internal transport message format, got (48,54,54,50)  
at org.elasticsearch.transport.netty.SizeHeaderFrameDecoder.decode(SizeHeaderFrameDecoder.java:64)

* * *

Jun 27, 2017 4:41:48 PM org.elasticsearch.client.transport.TransportClientNodesService$SimpleNodeSampler doSample  
INFO: [Bushmaster] failed to get node info for {#transport#-1}{127.0.0.1}{localhost/127.0.0.1:8887}, disconnecting...  
NodeDisconnectedException[[][localhost/127.0.0.1:8887][cluster:monitor/nodes/liveness] disconnected]

NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{127.0.0.1}{localhost/127.0.0.1:8887}]]  
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)  
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207)

Abdou

---

<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 25, 2017, 2:46pm UTC](https://discuss.elastic.co/t/elastic-search-nginx/90984/2 "2017-07-25T14:46:47Z")

</div>

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