# Getting Validation Failed: 1: mapping type is missing when making a text field aggregatable

**URL:** <https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725>\
**Category:** Elasticsearch\
**Created:** [April 24, 2020, 9:00pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725 "2020-04-24T21:00:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![karanmig12](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@karanmig12](https://discuss.elastic.co/u/karanmig12)\
**Post date:** [April 24, 2020, 9:00pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/1 "2020-04-24T21:00:30Z")

</div>

I am new to Elasticsearch and using 6.7

I am trying to make a text field aggregatabe in an existing index.

type": "action\_request\_validation\_exception",  
"reason": "Validation Failed: 1: mapping type is missing;"

```auto
PUT /my_index/_mappings
{
		"properties": {
		  "_doc":{
		  "colType": {
			"type": "text",
			"fields": {
			  "keyword": { 
				"type": "keyword"
			  }
			}
		  }
		}
		}
}
```

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 24, 2020, 11:29pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/2 "2020-04-24T23:29:46Z")

</div>

Can you try with:

```auto
PUT /my_index/_mapping/_doc
{
		"properties": {
		  "colType": {
			"type": "text",
			"fields": {
			  "keyword": { 
				"type": "keyword"
			  }
			}
		  }
	}
}

```

[Documentation](https://www.elastic.co/guide/en/elasticsearch/reference/6.7/indices-put-mapping.html)

Please be aware you need to reindex.

Sorry for the formatting, I am on mobile.

---

<div class="post-metadata">

**Author:** ![karanmig12](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@karanmig12](https://discuss.elastic.co/u/karanmig12)\
**Post date:** [April 25, 2020, 12:01am UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/3 "2020-04-25T00:01:35Z")

</div>

> [@Luca\_Belluccini](#):
>
> PUT /my\_index/\_mapping/\_doc { "properties": { "colType": { "type": "text", "fields": { "keyword": { "type": "keyword" } } } } }

Thank you for the quick respone , but now I get this error .  
Mapper for [colType] conflicts with existing mapping in other types:\n[mapper [colType] has different [analyzer]]

Just to add analyze is defined as "keyword" for this field.

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 25, 2020, 12:06am UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/4 "2020-04-25T00:06:55Z")

</div>

Can you share the output of `GET my_index`?

---

<div class="post-metadata">

**Author:** ![karanmig12](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@karanmig12](https://discuss.elastic.co/u/karanmig12)\
**Post date:** [April 25, 2020, 12:24am UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/5 "2020-04-25T00:24:52Z")

</div>

{  
"test" : {  
"aliases" : { },  
"mappings" : {  
"\_doc" : {  
"properties" : {  
"colType" : {  
"type" : "text",  
"analyzer" : "keyword"  
},  
"field1" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword"  
}  
}  
}  
}  
}  
},  
"settings" : {  
"index" : {  
"creation\_date" : "1587762638106",  
"number\_of\_shards" : "1",  
"number\_of\_replicas" : "1",  
"uuid" : "xxxxxxxxxxx", // masked the UUID  
"version" : {  
"created" : "6070099"  
},  
"provided\_name" : "test"  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [April 25, 2020, 5:40pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/6 "2020-04-25T17:40:39Z")

</div>

Thanks!

So you can use:

```auto
PUT /test/_mapping/_doc
{
  "properties": {
    "colType": {
      "type": "text",
      "analyzer": "keyword",
      "fields": {
        "keyword": {
          "type": "keyword"
        }
      }
    }
  }
}

```

BUT you will need to update all the documents in the index to be sure the documents get the `colType.keyword` field filled.

If your index hasn't a lot of documents you can proceed with:

```auto
POST test/_update_by_query
{
  "query": {
    "match_all": {}
  }
}

```

If the index is huge, it might be preferable to do a [reindex into another index](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html).

If you're using Kibana, do not forget to refresh your `index pattern`.

---

<div class="post-metadata">

**Author:** ![karanmig12](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@karanmig12](https://discuss.elastic.co/u/karanmig12)\
**Post date:** [April 25, 2020, 7:55pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/7 "2020-04-25T19:55:57Z")

</div>

This solved my problem . Thanks for the help

---

<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 23, 2020, 7:56pm UTC](https://discuss.elastic.co/t/getting-validation-failed-1-mapping-type-is-missing-when-making-a-text-field-aggregatable/229725/8 "2020-05-23T19:56:06Z")

</div>

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