# Invalid NEST response built from a unsuccessful () low level call on PUT: /indexname/\_doc/888

**URL:** <https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282>\
**Category:** Elasticsearch\
**Created:** [December 10, 2019, 11:10am UTC](https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282 "2019-12-10T11:10:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EmpeRoar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emperoar/32/59337_2.png) [@EmpeRoar](https://discuss.elastic.co/u/EmpeRoar)\
**Post date:** [December 10, 2019, 11:10am UTC](https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282/1 "2019-12-10T11:10:24Z")

</div>

Invalid NEST response built from a unsuccessful () low level call on PUT:

[1] BadRequest: Node: [http://localhost:9200/](http://localhost:9200/) Took: 00:00:00.2651740

# OriginalException: System.Net.Http.HttpRequestException: Cannot assign requested address

---\> System.Net.Sockets.SocketException (99): Cannot assign requested address  
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)  
--- End of inner exception stack trace ---  
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)  
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)  
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)  
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)  
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)  
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)  
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)  
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)  
at Elasticsearch.Net.HttpConnection.RequestAsync[TResponse](RequestData requestData, CancellationToken cancellationToken)

# Request:

{"[id":16,"firstName":"Julixxxus","lastName":"kokok","email":"jx@rx.com](mailto:id%22:16,%22firstName%22:%22Julixxxus%22,%22lastName%22:%22kokok%22,%22email%22:%22jx@rx.com)","mobile":"9181716"}

# Response:

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [December 11, 2019, 12:26am UTC](https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282/2 "2019-12-11T00:26:00Z")

</div>

@EmpeRoar can you provide more details:

1. how are you running Elasticsearch e.g. from zip, package, Docker?
2. how are your running the .NET client application e.g. on Windows, MacOS, Linux, in Docker?
3. version of .NET you are running e.g. .NET full framework, .NET Core? Version?

It's a `SocketException` coming from the underlying HTTP library attempting to connect to `localhost` on port 9200, which says to me this is likely a network configuration issue.

---

<div class="post-metadata">

**Author:** ![EmpeRoar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/emperoar/32/59337_2.png) [@EmpeRoar](https://discuss.elastic.co/u/EmpeRoar)\
**Post date:** [December 13, 2019, 11:24am UTC](https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282/3 "2019-12-13T11:24:14Z")

</div>

> [@forloop](#):
>
> - how are you running Elasticsearch e.g. from zip, package, Docker?
> - how are your running the .NET client application e.g. on Windows, MacOS, Linux, in Docker?
> - version of .NET you are running e.g. .NET full framework, .NET Core? Version?

1. I am running Elasticsearch using Docker via docker-compose .  
Elasticsearch dockerfile has this. : [docker.elastic.co/elasticsearch/elasticsearch:${ELK\_VERSION}](http://docker.elastic.co/elasticsearch/elasticsearch:$%7BELK_VERSION%7D)

2. Im in windows 10 machine, but my .net is in [asp.net](http://asp.net) core 3.0 via docker.

3. .net core 3.0

If I am not running my .net app in the same docker network with elasticsearch I can be able to connect.

var settings = new ConnectionSettings(new Uri("[http://localhost:9200](http://localhost:9200)"))  
.DefaultIndex("simplecustomer");  
settings.BasicAuthentication("elastic", "changeme");  
var client = new ElasticClient(settings);  
var asyncIndexResponse = await client.IndexDocumentAsync(customer);

but once I use docker to run my .net.. i cant be able to connect.  
Im thinking that its because of [http://localhost:9200](http://localhost:9200), but changing it to elasticsearch name defined in docker-compose, its complaining that it cannot read the supplied uri.

var settings = new ConnectionSettings(new Uri("elasticsearch "))

my docker-compose looks like this.

tp3-customers:  
image: tp3-customers  
restart: on-failure  
ports:  
- 5011:80  
depends\_on:  
- elasticsearch  
networks:  
- elk  
elasticsearch:  
build:  
context: elasticsearch/  
args:  
ELK\_VERSION: $ELK\_VERSION  
volumes:  
- type: bind  
source: ./elasticsearch/config/elasticsearch.yml  
target: /usr/share/elasticsearch/config/elasticsearch.yml  
read\_only: true  
- type: volume  
source: elasticsearch  
target: /usr/share/elasticsearch/data  
ports:  
- "9200:9200"  
- "9300:9300"  
environment:  
ES\_JAVA\_OPTS: "-Xmx256m -Xms256m"  
ELASTIC\_PASSWORD: changeme  
networks:  
- elk

---

<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:** [January 10, 2020, 11:24am UTC](https://discuss.elastic.co/t/invalid-nest-response-built-from-a-unsuccessful-low-level-call-on-put-indexname-doc-888/211282/4 "2020-01-10T11:24:16Z")

</div>

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