MapperParsingException - need help with dynamic property types


(pradeepjawahar) #1

I writing an application to index application logs into elastic search. I'm
having a problem when the type of a property changes in my data.
The following works fine

$ curl -XPOST http://localhost:9200/idx1/typ1 -d '

{"data": [
"0d7e6233e5f48b4f55c5376bf00b1be5",
"0d7e6233e5f48b4f55c5376bf00d94cf"
]}'
{"ok":true,"_index":"idx1","_type":"typ1","_id":"ntIyc5qfTnOPOz9uJ2dALg","_version":1}

But when I try to index another data point I run into the following problem
$ curl -XPOST http://localhost:9200/idx1/typ1 -d '
{"data":[
{
"k1":"val1"
},
{
"k2":"val2",
"k3":"val3"
}
],}'
{"error":"MapperParsingException[failed to parse [data]]; nested:
ElasticSearchIllegalArgumentException[unknown property [text]];
","status":400}

I understand that elastic search does not allow the type of a property to
be changed and that's causing the above Exception. I am usinn dynamic
mapping.Is there anyway I can circumvent this problem. I have tried the
following solutions :

  1. As suggested here
    http://stackoverflow.com/questions/15583032/nested-documents-in-elasticsearch to
    split my data.
  2. To use some kind of a filter so that elastic search always considers the
    field data to be an array of nested objects instead of an arrays of
    strings

The problem with the above two solutions are that I have several fields
which have the above characteristics and not all of them are known before
hand. So there could be a new field that's added to my data which behaves
roguely.

My question is there a standard procedure to seal with such indexing
issues. Any help will be much appreciated. I am using 0.90.5 on a centos5
host.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/21b999d3-fe90-48b7-aaaa-a93f3c02e5f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2