# Unable to store the data in index

**URL:** <https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332>\
**Category:** Elasticsearch\
**Created:** [June 11, 2018, 10:15am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332 "2018-06-11T10:15:12Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 5:29am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/23 "2018-06-15T05:29:32Z")

</div>

Could you tell us what logs are required to analysis further. I hope i have shared the required info. Kindly let me know what logs are required. So that i can try reproduce and share it.

And is there any way we can modify the index type without deleting it?

---

<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:** [June 15, 2018, 5:32am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/24 "2018-06-15T05:32:25Z")

</div>

I don't need logs at this stage.  
I need a script that I can play to reproduce the problem.

> And is there any way we can modify the index type without deleting it?

No. You need to reindex. You can look at the reindex API for that.

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 5:45am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/25 "2018-06-15T05:45:08Z")

</div>

here is the script kind which help you to create the index and try to add the data. In script 1st data set will be added(which is having ipv4) while the 2nd set will not added(which is having ipv6)

```
curl -X PUT "localhost:9200/register" -H 'Content-Type: application/json' -d'
{
"mappings":{
"register":{
	"properties":{
		"Uuid":{
			"type":"keyword"
		},
		"NodeType":{
			"type":"keyword"
		},
		"Address":{
			"type":"ip"
		},
		"NodeName":{
			"type":"keyword"
		}
	}
}
}
}'

curl -X POST "localhost:9200/register/register" -H 'Content-Type: application/json' -d'
{
	"NodeName" : "cfx",
	"Uuid" : "yuidje", 
	"NodeType" : "cscf",
	"Address" : "1.2.3.4"
}'
curl -X POST "localhost:9200/register/register" -H 'Content-Type: application/json' -d'
{
	"NodeName" : "cfx",
	"Uuid" : "yuidje", 
	"NodeType" : "cscf",
	"Address" : "2a00:8a00:a000:4000:0:0:a67:5c16"
}'

```

And i saw the reindex portion and it say that index name will be changed which actaully is not possible for my application as we have many program accessing with old index name.

Could you kindly let me know how we can change the indextype & mapping type alone.  
say at present i have below mapping  
\> {

> ```
> "settings":{
> },
> "mappings":{
> " **register**":{
> "properties":{
> "Uuid":{
> "type":"keyword"
> },
> "NodeType":{
> "type":"keyword"
> },
> "Address":{
> "type":" **keyword**"
> },
> "NodeName":{
> "type":"keyword"
> }
> }
> }
> }
> }`
> 
> ```

and i want to convert it to below mapping(highlighted the required change part)

> ```
> {
> "settings":{
> },
> "mappings":{
> " **register1**":{
> "properties":{
> "Uuid":{
> "type":"keyword"
> },
> "NodeType":{
> "type":"keyword"
> },
> "Address":{
> "type":" **ip**"
> },
> "NodeName":{
> "type":"keyword"
> }
> }
> }
> }
> }`
> 
> ```

---

<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:** [June 15, 2018, 6:01am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/26 "2018-06-15T06:01:37Z")

</div>

Does this script fails for you? Or works?

> And i saw the reindex portion and it say that index name will be changed which actaully is not possible for my application as we have many program accessing with old index name.

Yes. You need anyway to create a new index.  
This is why we are highly recommending in our trainings and talks to use aliases from the start. So you can switch the alias to a new index without stopping your application.

Here I'm afraid you will have to drop the index and rebuild it.

What you can do to optimize time wise your operation is to:

- Reindex in a new index like `register-01`
- When done, delete index `register`
- Create an alias named `register` for index `register-01`

The last 2 operations should take a very little time.

I of course suggest that you test this scenario and your script in a test environment.

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 6:12am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/27 "2018-06-15T06:12:16Z")

</div>

> [@dadoonet](#):
>
> Does this script fails for you? Or works?

It is both, like i have three block in that script

1. Creating register index -\> it works fine
2. Putting (ipv4)data to register index -\> it works fine
3. Putting (ipv6)data to register index -\> it fails

Thanks  
-Kishan

---

<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:** [June 15, 2018, 6:26am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/28 "2018-06-15T06:26:13Z")

</div>

I just tried this script in Kibana and everything works fine. At least with 6.3.0.

```auto
DELETE /register
PUT /register
{
  "mappings": {
    "register": {
      "properties": {
        "Uuid": {
          "type": "keyword"
        },
        "NodeType": {
          "type": "keyword"
        },
        "Address": {
          "type": "ip"
        },
        "NodeName": {
          "type": "keyword"
        }
      }
    }
  }
}
POST /register/register
{
	"NodeName" : "cfx",
	"Uuid" : "yuidje", 
	"NodeType" : "cscf",
	"Address" : "1.2.3.4"
}

POST /register/register
{
	"NodeName" : "cfx",
	"Uuid" : "yuidje", 
	"NodeType" : "cscf",
	"Address" : "2a00:8a00:a000:4000:0:0:a67:5c16"
}
GET /register/_search

```

This gives:

```auto
{
  "took": 38,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 1,
    "hits": [
      {
        "_index": "register",
        "_type": "register",
        "_id": "0w0eAmQBkD3wIOkZZcWE",
        "_score": 1,
        "_source": {
          "NodeName": "cfx",
          "Uuid": "yuidje",
          "NodeType": "cscf",
          "Address": "2a00:8a00:a000:4000:0:0:a67:5c16"
        }
      },
      {
        "_index": "register",
        "_type": "register",
        "_id": "0g0eAmQBkD3wIOkZTsUa",
        "_score": 1,
        "_source": {
          "NodeName": "cfx",
          "Uuid": "yuidje",
          "NodeType": "cscf",
          "Address": "1.2.3.4"
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 15, 2018, 6:36am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/29 "2018-06-15T06:36:57Z")

</div>

Are you by any chance on a very old version of Elasticsearch? If I recall correctly I think support for IPv6 addresses was added [in Elasticsearch 5.0](https://github.com/elastic/elasticsearch/pull/17746).

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 7:20am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/31 "2018-06-15T07:20:51Z")

</div>

I tried in my setup but it is failing, kindly let me know what i am missing

```
root@nhss01vm01oam02> curl -XDELETE 'localhost:9200/register'
{"acknowledged":true}root@nhs PUT "localhost:9200/register" -H 'Content-Type: application/json' -d'
{
"mappings":{
"register":{
"properties":{
"Uuid":{
"type":"keyword"
},
"NodeType":{
"type":"keyword"
},
"Address":{
"type":"ip"
},
"NodeName":{
"type":"keyword"
}
}
}
}
}'
{"acknowledged":true,"shards_acknowledged":true}root@nhss01vm01oam02> 
root@nhss01vm01oam02> curl -XGET 'localhost:9200/register/_mapping'
{"register":{"mappings":{"register":{"properties":{"Address":{"type":"ip"},"NodeName":{"type":"keyword"},"NodeType":{"type":"keyword"},"Uuid":{"type":"keyword"}}}}}}root@nhss01vm01oam02> 
root@nhss01vm01oam02> curl -X POST "localhost:9200/register/register" -H 'Content-Type: application/json' -d'
> {
> "NodeName" : "cfx",
> "Uuid" : "yuidje", 
> "NodeType" : "cscf",
> "Address" : "1.2.3.4"
> }'
{"_index":"register","_type":"register","_id":"AWQCUJGgZGhrCD-vGBa4","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"created":true}root@nhss01vm01oam02> 
root@nhss01vm01oam02> curl -X POST "localhost:9200/register/register" -H 'Content-Type: application/json' -d'
> {
> "NodeName" : "cfx",
> "Uuid" : "yuidje", 
> "NodeType" : "cscf",
> "Address" : "2a00:8a00:a000:4000:0:0:a67:5c16"
> }'
{"_index":"register","_type":"register","_id":"AWQCULhjZGhrCD-vGBa5","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"created":true}root@nhss01vm01oam02> 
root@nhss01vm01oam02> curl -XPOST 'localhost:9200/register/_search?pretty' -d '
> {
> "query": { "match_all": {} }
> }'
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : []
  }
}
```

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 7:22am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/32 "2018-06-15T07:22:01Z")

</div>

Version i am using is

> root@nhss01vm01oam02\> curl -XGET 'localhost:9200'  
> {  
> "name" : "nhss01vm01oam02",  
> "cluster\_name" : "elastic-OAMUNIT",  
> "cluster\_uuid" : "zQialZKYQJKOQUnR4ChZXw",  
> "version" : {  
> "number" : "5.1.1",  
> "build\_hash" : "5395e21",  
> "build\_date" : "2017-02-21T12:09:24.490Z",  
> "build\_snapshot" : true,  
> "lucene\_version" : "6.3.0"  
> },  
> "tagline" : "You Know, for Search"  
> }

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 7:23am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/33 "2018-06-15T07:23:04Z")

</div>

Kindly check and let me know, i am afraid that there is any issue in ES 5.1.1 version

---

<div class="post-metadata">

**Author:** ![kish](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kish](https://discuss.elastic.co/u/kish)\
**Post date:** [June 15, 2018, 7:30am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/34 "2018-06-15T07:30:21Z")

</div>

And also i am to see that data is getting deleted without any intervention. Not sure what happening with this index. Kindly help

```
root@nhss01vm01oam02> curl -X POST "localhost:9200/register/register" -H 'Content-Type: application/json' -d'
{
"NodeName" : "cfx",           
"Uuid" : "yuidje", 
"NodeType" : "cscf",
"Address" : "2a00:8a00:a000:4000:0:0:a67:5c16"
}'
{"_index":"register","_type":"register","_id":"AWQCV9wOZGhrCD-vGBbF","_version":1,"result":"created","_shards":{"total":2,"successful":2,"failed":0},"created":true}

 root@nhss01vm01oam02> curl -XPOST 'localhost:9200/register/_search?pretty' -d '
    {
          "query": { "match_all": {} }
        }'
        {
          "took" : 2,
          "timed_out" : false,
          "_shards" : {
            "total" : 5,
            "successful" : 5,
            "failed" : 0
          },
          "hits" : {
            "total" : 1,
            "max_score" : 1.0,
            "hits" : [
              {
                "_index" : "register",
                "_type" : "register",
                "_id" : "AWQCV9wOZGhrCD-vGBbF",
                "_score" : 1.0,
                "_source" : {
                  "NodeName" : "cfx",
                  "Uuid" : "yuidje",
                  "NodeType" : "cscf",
                  "Address" : "2a00:8a00:a000:4000:0:0:a67:5c16"
                }
              }
            ]
          }
        }

  root@nhss01vm01oam02> curl -XPOST 'localhost:9200/register/_search?pretty' -d '
        {
          "query": { "match_all": {} }
        }'
        {
          "took" : 1,
          "timed_out" : false,
          "_shards" : {
            "total" : 5,
            "successful" : 5,
            "failed" : 0
          },
          "hits" : {
            "total" : 0,
            "max_score" : null,
            "hits" : []
          }
        }
```

---

<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:** [June 15, 2018, 7:33am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/35 "2018-06-15T07:33:22Z")

</div>

Can you test with a more recent version?

---

<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 13, 2018, 7:33am UTC](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332/36 "2018-07-13T07:33:24Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/unable-to-store-the-data-in-index/135332.md?page=1)
