# Elasticsearch Broken?

**URL:** <https://discuss.elastic.co/t/elasticsearch-broken/22282>\
**Category:** Elasticsearch\
**Created:** [February 20, 2015, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-broken/22282 "2015-02-20T01:49:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![storyteller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/storyteller/32/891_2.png) [@storyteller](https://discuss.elastic.co/u/storyteller)\
**Post date:** [February 20, 2015, 1:49am UTC](https://discuss.elastic.co/t/elasticsearch-broken/22282/1 "2015-02-20T01:49:50Z")

</div>

Hello,

I recently started attempting to use elasticsearch to store some data.  
In the learning process, I was doing ok until I attempted using the bulk  
api.  
I used the something along the lines of:

conn = ES(url, timeout, bulksize)

for each (tuple)  
data = something(tuple)  
conn.index(data, index name, count, bulk=true)

Which I imagined would add a large number of items to localhost:9200/(index  
name)/(type name)/(count), but it ended up adding a large number of garbage  
at localhost:9200/(index name).  
Not sure how to proceed, but knowing that I needed a reset, I went ahead  
and did a delete on localhost:9200/\*, which deleted everything as expected.  
I thus attempted to begin again, with adding a index with mapping.

curl -XPUT "[http://localhost:9200/](http://localhost:9200/)(index name)" -d mapping.json

mapping.json:  
{  
"settings": {  
"analysis": {  
"analyzer": {  
"ngram\_analyzer": {  
"tokenizer": "ngram\_tokenizer"  
}  
},  
"tokenizer": {  
"ngram\_tokenizer": {  
"type": "nGram",  
"min\_gram": "2",  
"max\_gram": "3",  
"token\_chars": [  
"letter",  
"digit",  
"symbol",  
"punctuation",  
"whitespace"  
]  
}  
}  
}  
},  
"mappings": {  
"access": {  
"properties": {  
"date": {  
"type": "date",  
"format": "YYYY-MM-dd",  
"analyzer": "ngram\_analyzer"  
},  
"time": {  
"type": "date",  
"format": "HH:mm:ss",  
"analyzer": "ngram\_analyzer"  
},  
"protocol": {  
"type": "string",  
"analyzer": "ngram\_analyzer"  
},  
"source ip": {  
"type": "string",  
"analyzer": "ngram\_analyzer"  
},  
"source port": {  
"type": "integer"  
},  
"country": {  
"type": "string",  
"analyzer": "ngram\_analyzer"  
},  
"organization": {  
"type": "string",  
"analyzer": "ngram\_analyzer"  
},  
"dest ip": {  
"type": "string",  
"analyzer": "ngram\_analyzer"  
},  
"dest port": {  
"type": "integer"  
}  
}  
}  
}  
}

This is where the troubles began. While the above command created a node at  
(index name), it refused to populate the index with my settings.

{  
"darknet" : {  
"aliases" : { },  
"mappings" : { },  
"settings" : {  
"index" : {  
"creation\_date" : "1424425712525",  
"mapping" : {  
"json" : ""  
},  
"uuid" : "cgTEPkqnQJKejLPyHqVNYA",  
"number\_of\_replicas" : "1",  
"number\_of\_shards" : "5",  
"version" : {  
"created" : "1040399"  
}  
}  
},  
"warmers" : { }  
}  
}

I attempted to update the node with curl -XPUT "[http://localhost:9200/](http://localhost:9200/)(index name)/\_setting"  
-d mapping.json after a close, but that also left the index blank.  
I delete the index, create another index, etc. etc. but to no avail.

In the end, I manage to make a change to the index, though not a good one.  
I made a call to the update mapping API, which changed the index into a  
horrifying monstrosity with repeating tags, like so:

{  
"darknet" : {  
"aliases" : { },  
"mappings" : {  
"1" : {  
"properties" : {  
"mappings" : {  
"properties" : {  
"access" : {  
"properties" : {  
"properties" : {  
"properties" : {  
"country" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"date" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"format" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"dest ip" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"dest port" : {  
"properties" : {  
"type" : {  
"type" : "string"  
}  
}  
},  
"organization" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"protocol" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"source ip" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
},  
"source port" : {  
"properties" : {  
"type" : {  
"type" : "string"  
}  
}  
},  
"time" : {  
"properties" : {  
"analyzer" : {  
"type" : "string"  
},  
"format" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"settings" : {  
"properties" : {  
"analysis" : {  
"properties" : {  
"analyzer" : {  
"properties" : {  
"ngram\_analyzer" : {  
"properties" : {  
"tokenizer" : {  
"type" : "string"  
}  
}  
}  
}  
},  
"tokenizer" : {  
"properties" : {  
"ngram\_tokenizer" : {  
"properties" : {  
"max\_gram" : {  
"type" : "string"  
},  
"min\_gram" : {  
"type" : "string"  
},  
"token\_chars" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
},  
"settings" : {  
"index" : {  
"creation\_date" : "1424363851475",  
"uuid" : "TNBwPJxURz2kwA-bQJklIQ",  
"number\_of\_replicas" : "1",  
"number\_of\_shards" : "5",  
"version" : {  
"created" : "1040399"  
}  
}  
},  
"warmers" : { }  
}  
}

I'm guessing I broke something in the process of bulk indexing and  
subsequent mass deletion.  
I'm currently looking for a way to either fix this, or reset elasticsearch  
on my machine to "factory state". I would much appreciate it if you could  
give me a hand with this.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1b6381ed-1ba8-4be7-a25b-a24fc761c977%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b6381ed-1ba8-4be7-a25b-a24fc761c977%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [February 20, 2015, 4:49am UTC](https://discuss.elastic.co/t/elasticsearch-broken/22282/2 "2015-02-20T04:49:08Z")

</div>

Your curl is incorrect when using a file.

IIRC you should do something like:

curl -XPUT "[http://localhost:9200/](http://localhost:9200/)(index name)" -d @mapping.json

But check curl help.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 20 févr. 2015 à 02:49, Cong Hui [chui6@gatech.edu](mailto:chui6@gatech.edu) a écrit :
> 
> Hello,
> 
> I recently started attempting to use elasticsearch to store some data.  
> In the learning process, I was doing ok until I attempted using the bulk api.  
> I used the something along the lines of:
> 
> conn = ES(url, timeout, bulksize)
> 
> for each (tuple)  
> data = something(tuple)  
> conn.index(data, index name, count, bulk=true)
> 
> Which I imagined would add a large number of items to localhost:9200/(index name)/(type name)/(count), but it ended up adding a large number of garbage at localhost:9200/(index name).  
> Not sure how to proceed, but knowing that I needed a reset, I went ahead and did a delete on localhost:9200/\*, which deleted everything as expected. I thus attempted to begin again, with adding a index with mapping.
> 
> curl -XPUT "[http://localhost:9200/](http://localhost:9200/)(index name)" -d mapping.json
> 
> mapping.json:  
> {  
> "settings": {  
> "analysis": {  
> "analyzer": {  
> "ngram\_analyzer": {  
> "tokenizer": "ngram\_tokenizer"  
> }  
> },  
> "tokenizer": {  
> "ngram\_tokenizer": {  
> "type": "nGram",  
> "min\_gram": "2",  
> "max\_gram": "3",  
> "token\_chars": [  
> "letter",  
> "digit",  
> "symbol",  
> "punctuation",  
> "whitespace"  
> ]  
> }  
> }  
> }  
> },  
> "mappings": {  
> "access": {  
> "properties": {  
> "date": {  
> "type": "date",  
> "format": "YYYY-MM-dd",  
> "analyzer": "ngram\_analyzer"  
> },  
> "time": {  
> "type": "date",  
> "format": "HH:mm:ss",  
> "analyzer": "ngram\_analyzer"  
> },  
> "protocol": {  
> "type": "string",  
> "analyzer": "ngram\_analyzer"  
> },  
> "source ip": {  
> "type": "string",  
> "analyzer": "ngram\_analyzer"  
> },  
> "source port": {  
> "type": "integer"  
> },  
> "country": {  
> "type": "string",  
> "analyzer": "ngram\_analyzer"  
> },  
> "organization": {  
> "type": "string",  
> "analyzer": "ngram\_analyzer"  
> },  
> "dest ip": {  
> "type": "string",  
> "analyzer": "ngram\_analyzer"  
> },  
> "dest port": {  
> "type": "integer"  
> }  
> }  
> }  
> }  
> }
> 
> This is where the troubles began. While the above command created a node at (index name), it refused to populate the index with my settings.
> 
> {  
> "darknet" : {  
> "aliases" : { },  
> "mappings" : { },  
> "settings" : {  
> "index" : {  
> "creation\_date" : "1424425712525",  
> "mapping" : {  
> "json" : ""  
> },  
> "uuid" : "cgTEPkqnQJKejLPyHqVNYA",  
> "number\_of\_replicas" : "1",  
> "number\_of\_shards" : "5",  
> "version" : {  
> "created" : "1040399"  
> }  
> }  
> },  
> "warmers" : { }  
> }  
> }
> 
> I attempted to update the node with curl -XPUT "[http://localhost:9200/](http://localhost:9200/)(index name)/\_setting" -d mapping.json after a close, but that also left the index blank.  
> I delete the index, create another index, etc. etc. but to no avail.
> 
> In the end, I manage to make a change to the index, though not a good one.  
> I made a call to the update mapping API, which changed the index into a horrifying monstrosity with repeating tags, like so:
> 
> {  
> "darknet" : {  
> "aliases" : { },  
> "mappings" : {  
> "1" : {  
> "properties" : {  
> "mappings" : {  
> "properties" : {  
> "access" : {  
> "properties" : {  
> "properties" : {  
> "properties" : {  
> "country" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "date" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "format" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "dest ip" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "dest port" : {  
> "properties" : {  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "organization" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "protocol" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "source ip" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "source port" : {  
> "properties" : {  
> "type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "time" : {  
> "properties" : {  
> "analyzer" : {  
> "type" : "string"  
> },  
> "format" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> },  
> "settings" : {  
> "properties" : {  
> "analysis" : {  
> "properties" : {  
> "analyzer" : {  
> "properties" : {  
> "ngram\_analyzer" : {  
> "properties" : {  
> "tokenizer" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> },  
> "tokenizer" : {  
> "properties" : {  
> "ngram\_tokenizer" : {  
> "properties" : {  
> "max\_gram" : {  
> "type" : "string"  
> },  
> "min\_gram" : {  
> "type" : "string"  
> },  
> "token\_chars" : {  
> "type" : "string"  
> },  
> "type" : {  
> "type" : "string"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> },  
> "settings" : {  
> "index" : {  
> "creation\_date" : "1424363851475",  
> "uuid" : "TNBwPJxURz2kwA-bQJklIQ",  
> "number\_of\_replicas" : "1",  
> "number\_of\_shards" : "5",  
> "version" : {  
> "created" : "1040399"  
> }  
> }  
> },  
> "warmers" : { }  
> }  
> }
> 
> ## I'm guessing I broke something in the process of bulk indexing and subsequent mass deletion. I'm currently looking for a way to either fix this, or reset elasticsearch on my machine to "factory state". I would much appreciate it if you could give me a hand with this.
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1b6381ed-1ba8-4be7-a25b-a24fc761c977%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/1b6381ed-1ba8-4be7-a25b-a24fc761c977%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/55C855C0-33D5-44D2-B920-F987787BF175%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/55C855C0-33D5-44D2-B920-F987787BF175%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:31am UTC](https://discuss.elastic.co/t/elasticsearch-broken/22282/3 "2017-07-06T00:31:20Z")

</div>


