Update to a document with strict dynamic mapping index problem


(Mark O Stewart) #1

I am trying to update a record as a username was misspelled. I need to do something similar to change Steward to Stewart on a lastname field. I have dynamic = strict and i cannot figure out how to update this lastname record in this document.
There was another topic from around a year ago that had a similar request but no one answered it.

Hints or ideas would be appreciated.

The document index
GET /purchase_2016021/_search?q=sr.mateInfo.last:"Steward"
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 10.19355,
"hits": [
{
"_index": "purchase_2016021",
"_type": "subscriptions",
"_id": "13f8b602-ba1e-11e5-b116-0b4ceb2bd39c",
"_score": 10.19355,
"_source": {
"sId": "13f8b602-ba1e-11e5-b116-0b4ceb2bd39c",
"sState": "assigned",
"sv_aid": "aid-flo-0a83235e",
"sType": "dot",
"sr": {
"facility": {
"city": "Dallas",
"name": "Demo",
"state": "TX",
"zip": "75000",
"id": "demo"
},
"planId": "a",
"jId": 2003,
"custSite": "demo",
"sponsorEmail": "uh@huh.net",
"sponsorFirstName": "foo",
"sponsorLastName": "Tech",
"inmateInfo": {
"first": "Joe",
"last": "Steward"
}
},
"udate": "2016-01-13T20:45:30Z",
"cdate": "2016-01-13T17:50:05Z",
"orderNumber": 13267
}
}
]
}

When I try to update the record with:
PUT /purchase_2016021/post/13f8b602-ba1e-11e5-b116-0b4ceb2bd39c
{
"sId": "13f8b602-ba1e-11e5-b116-0b4ceb2bd39c",
"sState": "assigned",
"sv_aid": "aid-flo-0a83235e",
"sType": "dot",
"sr": {
"facility": {
"city": "Dallas",
"name": "Demo",
"state": "TX",
"zip": "75000",
"id": "demo"
},
"planId": "a",
"jId": 2003,
"custSite": "demo",
"sponsorEmail": "uh@huh.net",
"sponsorFirstName": "foo",
"sponsorLastName": "Tech",
"inmateInfo": {
"first": "Joe",
"last": "Stewart"
}
},
"udate": "2016-01-13T20:45:30Z",
"cdate": "2016-01-13T17:50:05Z",
"orderNumber": 13267
}

I get the following error:
"error": {
"root_cause": [
{
"type": "strict_dynamic_mapping_exception",
"reason": "mapping set to strict, dynamic introduction of [sId] within [post] is not allowed"
}

ANY ideas will be MUCH appreciated.

Thank You in Advance


(Jörg Prante) #2

Are you sure you have the correct index _type of the document addressed?

Try

PUT /purchase_2016021/subscriptions/13f8b602-ba1e-11e5-b116-0b4ceb2bd39c 
{
"sId": "13f8b602-ba1e-11e5-b116-0b4ceb2bd39c",
...
}

(Mark O Stewart) #3

Thank you VERY much that was the piece I needed. I knew I was close but could't seem to find the key.

Again Thank You for the quick reply and correct answer.

Mark


(system) #4