# How to solve field in mapping but already used in other types

**URL:** <https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067>\
**Category:** Elasticsearch\
**Created:** [March 1, 2016, 2:52am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067 "2016-03-01T02:52:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![szcountryboy](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@szcountryboy](https://discuss.elastic.co/u/szcountryboy)\
**Post date:** [March 1, 2016, 2:52am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/1 "2016-03-01T02:52:58Z")

</div>

I also run topbeat, packbeat, transfer to logstash, accept the data on the ES side, reported the following error

[2016-03-01 02:33:49,810][DEBUG][action.bulk] [node-1] [logstash-2016.02.29][4] failed to execute bulk item (index) index {[logstash-2016.02.29][mysql][AVMuTs3DYEsGBQRKvfBP], source[{"@timestamp":"2016-02-29T18:33:48.342Z","beat":{"hostname":"server1","name":"server1"},"bytes\_in":51,"bytes\_out":51,"client\_ip":"192.168.51.105","client\_port":57663,"client\_proc":"","client\_server":"","count":1,"direction":"in","ip":"192.168.4.12","method":"INSERT","mysql":{"affected\_rows":0,"error\_code":1054,"error\_message":"42S22: Unknown column 'aaaaa' in 'field list'","insert\_id":0,"iserror":true,"num\_fields":0,"num\_rows":0},"path":"","port":3306,"proc":"","query":"insert into test(id,title) values(aaaaa,'987')","responsetime":0,"server":"","status":"Error","type":"mysql","@version":"1","host":"server1","tags":["beats\_input\_raw\_event"]}]}  
java.lang.IllegalArgumentException: Field [proc] is defined as a field in mapping [mysql] but this name is already used for an object in other types  
at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:398)  
at org.elasticsearch.index.mapper.MapperService.checkMappersCompatibility(MapperService.java:411)

Topbeat inside the proc (proc.ppid etc) is a digital type, but the MySQL proc is a string type?

Thanks. 🙂

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 1, 2016, 5:22am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/2 "2016-03-01T05:22:49Z")

</div>

The best solution is to store the data in different indices so this conflict doesn't happen!

---

<div class="post-metadata">

**Author:** ![szcountryboy](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@szcountryboy](https://discuss.elastic.co/u/szcountryboy)\
**Post date:** [March 1, 2016, 5:50am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/3 "2016-03-01T05:50:56Z")

</div>

Only one es, topbeat ---\> logstash1, packetbeat---\> logstash2, while logstash is output to the same es, such data will be merged into logstash-\*.  
It will report the error above, unless the creation of multiple es  
java.lang.IllegalArgumentException: Field [proc] is defined as a field in mapping [mysql] but this name is already used for an object in other types

thanks.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 1, 2016, 5:53am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/4 "2016-03-01T05:53:08Z")

</div>

If you have multiple inputs, ie one per beat, then use tags and conditional outputs for each one.

---

<div class="post-metadata">

**Author:** ![szcountryboy](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@szcountryboy](https://discuss.elastic.co/u/szcountryboy)\
**Post date:** [March 1, 2016, 6:18am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/5 "2016-03-01T06:18:14Z")

</div>

packetbeat.yml configuration is as follows:

logstash:  
hosts: ["192.168.4.13:5044"]

shipper:  
tags: ["packetbeat","192.168.4.13"]

topbeat.yml configuration is as follows:

logstash:  
hosts: ["192.168.4.13:5045"]

shipper:  
tags: ["topbeat","192.168.4.12"]

* * *

input {  
beats {  
port =\> 5044 logstash1---\>5044 , logstash2---\>5045  
}  
}

## output { elasticsearch { hosts =\> ["server1:9200"] } stdout{ codec =\> rubydebug } }

At the same time to run TopBeat and PacketBeat,  
the es raise exception:  
java.lang.IllegalArgumentException: Field [proc] is defined as a field in mapping [mysql] but this name is already used for an object in other types

Merge the mapping field by manual, the error is still reported

Thanks.

---

<div class="post-metadata">

**Author:** ![szcountryboy](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@szcountryboy](https://discuss.elastic.co/u/szcountryboy)\
**Post date:** [March 1, 2016, 6:55am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/6 "2016-03-01T06:55:06Z")

</div>

Add the following two items in beats.conf (logstash configuration) to soluted  
index =\> "logstash-%{type}-%{+YYYY.MM.dd}"  
document\_type =\> "%{type}"

Near by elasticsearch node

Thanks everybody.

---

<div class="post-metadata">

**Author:** ![dylanpierce](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dylanpierce/32/15023_2.png) [@dylanpierce](https://discuss.elastic.co/u/dylanpierce)\
**Post date:** [June 20, 2017, 5:52pm UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/7 "2017-06-20T17:52:58Z")

</div>

Using 5.4 with the searchkick gem.

My solution was actually a misnaming of a mapping. My mapping defined a `locations_coordinates` but I was indexing by `location_coordinates` even though it was a misnaming this exception was thrown.

---

<div class="post-metadata">

**Author:** ![drivera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/drivera/32/39900_2.png) [@drivera](https://discuss.elastic.co/u/drivera)\
**Post date:** [October 24, 2018, 11:10pm UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/8 "2018-10-24T23:10:04Z")

</div>

Hi, the index and document type lines, should they go under the filters section? Thank you.

---

<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:** [November 4, 2022, 4:15am UTC](https://discuss.elastic.co/t/how-to-solve-field-in-mapping-but-already-used-in-other-types/43067/9 "2022-11-04T04:15:32Z")

</div>


