Mapping name-value pair that has multiple value types


(hardtke) #1

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


(David Pilato) #2

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 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


(system) #3