# Curl: (7) failed to connect to localhost port 9200: connection refused using curl -X PUT "localhost:9200"

**URL:** <https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905>\
**Category:** Elasticsearch\
**Created:** [April 8, 2019, 7:02pm UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905 "2019-04-08T19:02:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 8, 2019, 7:02pm UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/1 "2019-04-08T19:02:00Z")

</div>

Need help guys! please

I add mappings on Elasticsearch using this command line

curl -X PUT "localhost:9200/newsout/\_mapping/test-type" -H 'Content-Type: application/json' -d' {  
"properties": {  
"author": { "type": "string" },  
"date": {  
"type": "date",  
"format": "yyyy-MM-dd"  
},  
"description": {  
"type": "string",  
"analyzer": "french"  
},  
"topics": { "type": "string" },  
"link": { "type": "string", "index": "not\_analyzed" },  
"locations": { "type": "string" },  
"organizations": { "type": "string" },  
"persons": { "type": "string" },  
"text": {  
"type": "string",  
"analyzer": "french"  
},  
"title": {  
"type": "string",  
"analyzer": "french"  
}  
}  
}'

it appears that this error occurs

curl: (7) failed to connect to localhost port 9200: connection refused

you have to notice that this errors happens when I upgraded Elasticsearch from (alpine-elasticsearch ----\>Elasticsearch v 6.0.0)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 8, 2019, 10:14pm UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/2 "2019-04-08T22:14:21Z")

</div>

Sounds like the service is not running or that there is a network blocker somewhere.

---

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 9, 2019, 5:13am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/3 "2019-04-09T05:13:23Z")

</div>

When i return to old version Using alpine-Elasticsearch image on docker compose (i think it is 2.2.1 version)everything seems to work.the erronés happent only when i tap curl -X Put to create a mapping for my index.

Can i provide to you my docker compose if it is needed ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 9, 2019, 6:01am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/4 "2019-04-09T06:01:10Z")

</div>

What are elasticsearch logs?

---

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 9, 2019, 6:52am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/5 "2019-04-09T06:52:29Z")

</div>

elasticsearch\_1 | [2019-04-09T06:50:19,089][INFO][o.e.n.Node] initializing ...  
elasticsearch\_1 | [2019-04-09T06:50:19,281][INFO][o.e.e.NodeEnvironment] [jSjxvbp] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/dm-0)]], net usable\_space [20.6gb], net total\_space [47.9gb], types [ext4]  
elasticsearch\_1 | [2019-04-09T06:50:19,282][INFO][o.e.e.NodeEnvironment] [jSjxvbp] heap size [1007.3mb], compressed ordinary object pointers [true]  
elasticsearch\_1 | [2019-04-09T06:50:19,286][INFO][o.e.n.Node] node name [jSjxvbp] derived from node ID [jSjxvbpOSXicUUeDO\_W8mw]; set [node.name] to override  
elasticsearch\_1 | [2019-04-09T06:50:19,289][INFO][o.e.n.Node] version[6.0.0], pid[1], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Linux/3.16.0-4-amd64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0\_151/25.151-b12]  
elasticsearch\_1 | [2019-04-09T06:50:19,289][INFO][o.e.n.Node] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config]  
elasticsearch\_1 | [2019-04-09T06:50:22,906][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [aggs-matrix-stats]  
elasticsearch\_1 | [2019-04-09T06:50:22,912][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [analysis-common]  
elasticsearch\_1 | [2019-04-09T06:50:22,912][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [ingest-common]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [lang-expression]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [lang-mustache]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [lang-painless]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [parent-join]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [percolator]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [reindex]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [repository-url]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [transport-netty4]  
elasticsearch\_1 | [2019-04-09T06:50:22,913][INFO][o.e.p.PluginsService] [jSjxvbp] loaded module [tribe]  
elasticsearch\_1 | [2019-04-09T06:50:22,914][INFO][o.e.p.PluginsService] [jSjxvbp] loaded plugin [ingest-geoip]  
elasticsearch\_1 | [2019-04-09T06:50:22,914][INFO][o.e.p.PluginsService] [jSjxvbp] loaded plugin [ingest-user-agent]  
elasticsearch\_1 | [2019-04-09T06:50:22,914][INFO][o.e.p.PluginsService] [jSjxvbp] loaded plugin [x-pack]  
elasticsearch\_1 | [2019-04-09T06:50:29,073][INFO][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/89] [Main.cc@128] controller (64 bit): Version 6.0.0 (Build 8e6ab35cf803a2) Copyright (c) 2017 Elasticsearch BV  
elasticsearch\_1 | [2019-04-09T06:50:29,301][INFO][o.e.d.DiscoveryModule] [jSjxvbp] using discovery type [zen]  
elasticsearch\_1 | [2019-04-09T06:50:31,881][INFO][o.e.n.Node] initialized  
elasticsearch\_1 | [2019-04-09T06:50:31,881][INFO][o.e.n.Node] [jSjxvbp] starting ...  
elasticsearch\_1 | [2019-04-09T06:50:32,311][INFO][o.e.t.TransportService] [jSjxvbp] publish\_address {172.18.0.3:9300}, bound\_addresses {0.0.0.0:9300}  
elasticsearch\_1 | [2019-04-09T06:50:32,357][INFO][o.e.b.BootstrapChecks] [jSjxvbp] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks  
elasticsearch\_1 | ERROR: [1] bootstrap checks failed  
elasticsearch\_1 | [1]: max virtual memory areas vm.max\_map\_count [65530] is too low, increase to at least [262144]  
elasticsearch\_1 | [2019-04-09T06:50:32,397][INFO][o.e.n.Node] [jSjxvbp] stopping ...  
elasticsearch\_1 | [2019-04-09T06:50:32,443][INFO][o.e.n.Node] [jSjxvbp] stopped  
elasticsearch\_1 | [2019-04-09T06:50:32,444][INFO][o.e.n.Node] [jSjxvbp] closing ...  
elasticsearch\_1 | [2019-04-09T06:50:32,467][INFO][o.e.n.Node] [jSjxvbp] closed  
elasticsearch\_1 | [2019-04-09T06:50:32,471][INFO][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started

---

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 9, 2019, 7:05am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/6 "2019-04-09T07:05:51Z")

</div>

i think my problem is related to elasticsearch\_1 | [1]: max virtual memory areas vm.max\_map\_count [65530] is too low, increase to at least [262144] ,so,i used this command line sysctl -w vm.max\_map\_count=262144 to increase virtual memory in docker\_images folder .

Then i retry again to add mapping for my index ,i see this error : {"error":{"root\_cause":[{"type":"mapper\_parsing\_exception","reason":"No handler for type [string] declared on field [author]"}],"type":"mapper\_parsing\_exception","reason":"No handler for type [string] declared on field [author]"},"status":400}(

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 9, 2019, 7:06am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/7 "2019-04-09T07:06:03Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.

Here the problem is:

> [@idris](#):
>
> ```
> elasticsearch_1 | ERROR: [1] bootstrap checks failed
> elasticsearch_1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
> 
> ```

Please read [Bootstrap Checks | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html)

---

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 9, 2019, 7:11am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/9 "2019-04-09T07:11:59Z")

</div>

```
elasticsearch_1 | ERROR: [1] bootstrap checks failed
elasticsearch_1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

```

i think my problem is related to elasticsearch\_1 | [1]: max virtual memory areas vm.max\_map\_count [65530] is too low, increase to at least [262144] ,so,i used this command line

```
sysctl -w vm.max_map_count=262144 to increase virtual memory in docker_images folder

```

Then i retry again to add mapping for my index ,i see this error

```
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [author]"}],"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [author]"},"status":400}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 9, 2019, 7:43am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/10 "2019-04-09T07:43:17Z")

</div>

That's another error and another problem that would deserve a new question.

Anyway, it's just because `string` does not exist anymore in mapping. Use `text` or `keyword` instead. If you have further question, please open a new question.

---

<div class="post-metadata">

**Author:** ![idris](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@idris](https://discuss.elastic.co/u/idris)\
**Post date:** [April 9, 2019, 7:47am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/11 "2019-04-09T07:47:08Z")

</div>

thank you

---

<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:** [May 7, 2019, 7:47am UTC](https://discuss.elastic.co/t/curl-7-failed-to-connect-to-localhost-port-9200-connection-refused-using-curl-x-put-localhost-9200/175905/12 "2019-05-07T07:47:08Z")

</div>

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