# How to have \_all mapping in es6 without indexing the source field

**URL:** <https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130>\
**Category:** Elasticsearch\
**Created:** [July 31, 2019, 1:57pm UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130 "2019-07-31T13:57:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Hawkins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adam_hawkins/32/51334_2.png) [@Adam\_Hawkins](https://discuss.elastic.co/u/Adam_Hawkins)\
**Post date:** [July 31, 2019, 1:57pm UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130/1 "2019-07-31T13:57:00Z")

</div>

I'm trying to index a document that has 1000s of fields, i'm only interested if the search text exists in the document. not searching on the specific field.  
I understand that v5 had an \_all field which indexed the aggregation of text from all fields, whereas this was removed in v6 , but can be replicated using copy\_to on the source field to the target field. However i don't want to index the source field as well, and I cant combine copy\_to and enabled: false on the field  
here's my test case which is failing in ElasticSearch service 'test'

DELETE alltest  
PUT alltest  
{  
"mappings": {  
"doc": {  
"properties" : {  
"all": {"type": "text"},  
"firstname": {"type" : "text", "copy\_to": "all", "enabled": false},  
"surname": {"type" : "text", "copy\_to": "all", "enabled": false}  
}  
}  
}  
}

PUT alltest/doc/1  
{  
"firstname": "molly",  
"surname": "miggings"  
}

This gives :  
"reason": "Mapping definition for [firstname] has unsupported parameters: [enabled : false]"

if i make enabled : true , then molly is indexed in all and firstname, if I make type: object then molly is not indexed in all and firstname is not indexed.  
I want molly indexed in all, but firstname not indexed.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [August 2, 2019, 2:51pm UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130/2 "2019-08-02T14:51:03Z")

</div>

Hi,

instead of disabling the field completely (`"enabled": false`), you can disable indexing via `"index": false`.

Daniel

---

<div class="post-metadata">

**Author:** ![Adam\_Hawkins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adam_hawkins/32/51334_2.png) [@Adam\_Hawkins](https://discuss.elastic.co/u/Adam_Hawkins)\
**Post date:** [August 5, 2019, 9:09am UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130/3 "2019-08-05T09:09:12Z")

</div>

Thanks Daniel,

That does indeed work, but the firstname & surname still register as a field though they are neither searchable or aggregatable (as seen in kibana index patterns) so contribute to the total field count which is by default capped at 1000 (index.mapping.total\_fields).  
Do you think it would be safe to push this up substantially to account for these fields?

 ![24](https://us1.discourse-cdn.com/elastic/original/3X/7/d/7d7642c6d3c32868a21cfede4f0985a4942329b6.png)

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [August 5, 2019, 11:43am UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130/4 "2019-08-05T11:43:28Z")

</div>

Hi,

please note that these settings would also exist in the mapping even if you had set `"enabled": false`. As the mapping may get large in either case (several MB), for example the message body of a (full) cluster state update will become larger and in general the larger mapping will put more strain on the cluster but it might be ok for your use-case. If feasible I suggest you increase the index setting `index.mapping.total_fields.limit` accordingly in a test cluster first to see how it copes in your case. I hope that helps you move forward.

Daniel

---

<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:** [September 2, 2019, 11:43am UTC](https://discuss.elastic.co/t/how-to-have-all-mapping-in-es6-without-indexing-the-source-field/193130/5 "2019-09-02T11:43:50Z")

</div>

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