# Mapping conflict

**URL:** <https://discuss.elastic.co/t/mapping-conflict/350919>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [January 12, 2024, 8:28am UTC](https://discuss.elastic.co/t/mapping-conflict/350919 "2024-01-12T08:28:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mb19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb19/32/130739_2.png) [@mb19](https://discuss.elastic.co/u/mb19)\
**Post date:** [January 12, 2024, 8:28am UTC](https://discuss.elastic.co/t/mapping-conflict/350919/1 "2024-01-12T08:28:23Z")

</div>

Hello everyone,

I am new to using the Elasticsearch and Kiabana stack, I do not currently have Logstash installed and would prefer not to install it.

I recently had this error:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/4/04e2d64b91f3cde746f976a2324797dfd8548883.png)

I don't know how to fix it, I think I have some conceptual problems, I have tried creating a second index called "prueba" using the reindex API:

```auto
POST _reindex?wait_for_completion=false
{
  "source": {
    "index": "metrics-*"
  },
  "dest": {
    "index": "prueba"
  }
}

```

But I don't know how to proceed now.

- Would it be possible to simply fix the data type of that field?

- Would it be possible to delete the field or delete the metrics and start again from scratch? (since I am in a testing environment and the information is not relevant)

Although I would like to know how to solve it properly for when the environment is production

Thank you very much to all! 💐

---

<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:** [January 12, 2024, 9:25am UTC](https://discuss.elastic.co/t/mapping-conflict/350919/2 "2024-01-12T09:25:33Z")

</div>

Welcome!

The error message indicates that you have one of the index starting with `metrics-` which has a wrong mapping.  
So you need to find first what is this index.

You can do that by comparing all the mappings (which might be a very manual task though). You can run the following command in the Dev Console:

```auto
GET /metrics-*/_mapping/field/host.ip

```

Once you know, you can:

- Remove the wrong index (but this will remove its data)
- Reindex the wrong index with the right mapping to a new index named like `metrics-xxx-fixed` and then remove the wrong index

But you also need to understand who or which tool created this wrong index. Was that a manual test you did? A bug?...

> [@mb19](#):
>
> Would it be possible to simply fix the data type of that field?

No. "Simply" would mean to reindex. Which is what I suggested and what you did somehow.

> [@mb19](#):
>
> Would it be possible to delete the field or delete the metrics and start again from scratch? (since I am in a testing environment and the information is not relevant)

Yes.

Hope this helps

---

<div class="post-metadata">

**Author:** ![mb19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb19/32/130739_2.png) [@mb19](https://discuss.elastic.co/u/mb19)\
**Post date:** [January 12, 2024, 9:56am UTC](https://discuss.elastic.co/t/mapping-conflict/350919/3 "2024-01-12T09:56:03Z")

</div>

Hello! Thank you very much for the quick response,

About finding the conflicting index, sorry, I knew which but I forgot to mention it. Although I didn't really know how to use this information either, Kibana's own interface shows it here:

![image](https://us1.discourse-cdn.com/elastic/original/3X/3/7/3717480f598887c5559a806e79e6a8e95ffaf95d.png)

About the tool that created the wrong index, I don't know. From what I see in the image, I guess that it was the mysql integration.

I have a policy in one agent with these two integrations ( System Integration and MySQL Integration), and it was yesterday when I added the mysql one and when I saw the error.

But about reindexing, what I did was reindex all those indexes that started with "metrics-", right? So what should I do in this specific case is this?

```auto

POST _reindex?wait_for_completion=false
{
   "source": {
     "index": ".ds-metrics-mysql.performance-default-2024.01.11-000001"
   },
   "dest": {
     "index": ".ds-metrics-mysql.performance-default-2024.01.11-000001-FIXED"
   }
}

```

​

---

<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:** [January 12, 2024, 11:06am UTC](https://discuss.elastic.co/t/mapping-conflict/350919/4 "2024-01-12T11:06:01Z")

</div>

Yes. Something like:

```auto
POST _reindex?wait_for_completion=false
{
   "source": {
     "index": ".ds-metrics-mysql.performance-default-2024.01.11-000001"
   },
   "dest": {
     "index": ".ds-metrics-mysql.performance-default-2024.01.11-000001-FIXED"
   }
}
DELETE .ds-metrics-mysql.performance-default-2024.01.11-000001

```

---

<div class="post-metadata">

**Author:** ![mb19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb19/32/130739_2.png) [@mb19](https://discuss.elastic.co/u/mb19)\
**Post date:** [January 12, 2024, 12:35pm UTC](https://discuss.elastic.co/t/mapping-conflict/350919/5 "2024-01-12T12:35:21Z")

</div>

Hello,

Unfortunately it hasn't worked, the console does not warn if the task has finished or not, I cannot find the new index either in "Index Management" or in "dataView/metrics-\*"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/2/f2bac1c88921dada18006ade0dbf5114c730d8db.png)

Finally if I try to delete it by executing:

` DELETE .ds-metrics-mysql.performance-default-2024.01.11-000001`

I get:

**index [.ds-metrics-mysql.performance-default-2024.01.11-000001] is the write index for data stream [metrics-mysql.performance-default] and cannot be deleted"**

Then I have tried this;

`DELETE /_data_stream/.ds-metrics-mysql.performance-default-2024.01.11-000001`

But then I get:

**data streams [.ds-metrics-mysql.performance-default-2024.01.11-000001] not found"**

Although the initial error about the mapping conflict persists and so does the field with this entry (I have refreshed the page)

---

<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:** [January 12, 2024, 12:49pm UTC](https://discuss.elastic.co/t/mapping-conflict/350919/6 "2024-01-12T12:49:35Z")

</div>

`wait_for_completion=false` does not wait for reindexing to be finished.  
So you need to either set it to true or use the [tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html).

As you said you don't need the old data, so remove everything and start again might be the easiest way.

```auto
GET /_data_stream/

```

will give you the exact name to use.

---

<div class="post-metadata">

**Author:** ![mb19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb19/32/130739_2.png) [@mb19](https://discuss.elastic.co/u/mb19)\
**Post date:** [January 12, 2024, 2:23pm UTC](https://discuss.elastic.co/t/mapping-conflict/350919/7 "2024-01-12T14:23:29Z")

</div>

Hello,

On the one hand, if I put "wait\_for\_completion=false", I get the following output:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/c/0c385dbdb8626bf5b99cc949959d7df3bb7369e9.png)

On the other hand, maybe I'm not understanding something, the exact name is told to me by the conflicting field, anyway I used the command you suggested:

`GET /_data_stream/`

And I have obtained this (which matches the name seen in the first screenshot of the post)

```auto
{
      "name": "metrics-mysql.performance-default",
      "timestamp_field": {
        "name": "@timestamp"
      },
      "indices": [
        {
          "index_name": ".ds-metrics-mysql.performance-default-2024.01.11-000001",
          "index_uuid": "2XQCG80ySGWbW1UU51h2Bg",
          "prefer_ilm": true,
          "ilm_policy": "metrics",
          "managed_by": "Index Lifecycle Management"
        }
    ......

```

Therefore I still have the same problem if I run

`DELETE /_data_stream/.ds-metrics-mysql.performance-default-2024.01.11-000001`

This is the output:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "resource_not_found_exception",
        "reason": "data streams [.ds-metrics-mysql.performance-default-2024.01.11-000001] not found"
      }
    ],
    "type": "resource_not_found_exception",
    "reason": "data streams [.ds-metrics-mysql.performance-default-2024.01.11-000001] not found"
  },
  "status": 404
}

```

---

<div class="post-metadata">

**Author:** ![mb19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mb19/32/130739_2.png) [@mb19](https://discuss.elastic.co/u/mb19)\
**Post date:** [January 12, 2024, 2:30pm UTC](https://discuss.elastic.co/t/mapping-conflict/350919/8 "2024-01-12T14:30:14Z")

</div>

Little update, I ran this and the error is gone although I assume the data too:

`DELETE /_data_stream/metrics-mysql.performance-default`

For future occasions I would like to know what I could do since now the information was not important but later it will be

Thank you so much!

---

<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:** [February 9, 2024, 2:30pm UTC](https://discuss.elastic.co/t/mapping-conflict/350919/9 "2024-02-09T14:30:48Z")

</div>

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