Here is my index(sub_application), I need to pass values to the keys (id, name) in approved_by object. I tried in different ways nothing workout
{
"settings": {
},
"mappings": {
"sub_application": {
"properties": {
"archived_at": {
"type": "date"
},
"approved_by": {
"properties": {
"name": {
"type": "text"
},
"id": {
"type": "text"
}
}
}
}
}
}
}
Attempt1:
for info in sub_application_obj['hits']['hits']:
print(info)
item = info['_source']
current_employer = item['approved_by']
client.update(index='sub_application',
doc_type='sub_application',
body={'doc': {
current_employer['name']: approved_user,
current_employer['id']: approved_userid
}},
id=info['_id'])
Attempt2:
client.update(index='sub_application',
doc_type='sub_application',
body={'doc': {
['approved_by']['name']: approved_user,
['approved_by']['id']: approved_userid
}},
id=info['_id'])
Attemp3:
client.update(index='sub_application',
doc_type='sub_application',
body={'doc': {
['approved_by.name']: approved_user,
['approved_by.id']: approved_userid
}},
id=info['_id'])
I need to pass approved_user and approved_userid to the keys name, id in approved_by object. I tried but didn't get it,please help me guys.