# Mapping name-value pair that has multiple value types

**URL:** <https://discuss.elastic.co/t/mapping-name-value-pair-that-has-multiple-value-types/8618>\
**Category:** Elasticsearch\
**Created:** [August 3, 2012, 12:36am UTC](https://discuss.elastic.co/t/mapping-name-value-pair-that-has-multiple-value-types/8618 "2012-08-03T00:36:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hardtke](https://avatars.discourse-cdn.com/v4/letter/h/d2c977/32.png) [@hardtke](https://discuss.elastic.co/u/hardtke)\
**Post date:** [August 3, 2012, 12:36am UTC](https://discuss.elastic.co/t/mapping-name-value-pair-that-has-multiple-value-types/8618/1 "2012-08-03T00:36:21Z")

</div>

We have a large existing database that we are trying to import into  
elasticsearch using the CouchDB river. The documents in this database have  
the unfortunate property that if if particular name-value pair does not  
exist, the value is false. For instance, most documents would have:

"location":{"city":"San Francisco"}

but in the event were there is no location, it would be

"location":false

I have trying to turn off dynamic mapping, set up my own custom mapping,  
etc, but nothing works -- I always fail to index the documents. Once  
elasticsearch has decided on a mapping type, it will fail the first time it  
sees the alternative type (boolean rather that object). What I would like  
is for true,false, or null values to be simply ignored during mapping. Is  
there any way to do this? Is there another approach that would work?

Thanks,

David Hardtke

---

<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:** [August 3, 2012, 7:27am UTC](https://discuss.elastic.co/t/mapping-name-value-pair-that-has-multiple-value-types/8618/2 "2012-08-03T07:27:07Z")

</div>

You can not have different type for the same field.  
Location is an object. You can't send a boolean.

But, you can send null. Or don't send any location.

## HTH David

Le 3 août 2012 à 02:36, hardtke [davidhardtke@gmail.com](mailto:davidhardtke@gmail.com) a écrit :

> We have a large existing database that we are trying to import into elasticsearch using the CouchDB river. The documents in this database have the unfortunate property that if if particular name-value pair does not exist, the value is false. For instance, most documents would have:
> 
> "location":{"city":"San Francisco"}
> 
> but in the event were there is no location, it would be
> 
> "location":false
> 
> I have trying to turn off dynamic mapping, set up my own custom mapping, etc, but nothing works -- I always fail to index the documents. Once elasticsearch has decided on a mapping type, it will fail the first time it sees the alternative type (boolean rather that object). What I would like is for true,false, or null values to be simply ignored during mapping. Is there any way to do this? Is there another approach that would work?
> 
> Thanks,
> 
> David Hardtke

---

<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 6, 2017, 3:17am UTC](https://discuss.elastic.co/t/mapping-name-value-pair-that-has-multiple-value-types/8618/3 "2017-07-06T03:17:55Z")

</div>


