globocom / globocom/tornado-es
update api doesn't work right
- Dominant language
- Python
- Stars
- 95
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
I try to use `update` api to update document's version ,but result seems wrong ,`update` add a new attribute to the document, for example,
```
{
"supplier_matchcode": "SMPE",
"article_number": "CS1342",
"description": "Fuel Parts",
"url": "",
"len": 6,
"label": "Sensor",
"version": 0,
"supplier_cname": "",
"supplier": "SMPE",
"group": "",
"replace_numbers": "",
"utility_number": ""
}
```
I use below script to update it's version
```
{
"script": "ctx._source.version+=1"
}
```
this work right in Official elasticsearch, after update I will get this
```
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "brand",
"_type": "part",
"_id": "CS1342",
"_score": 1,
"_source": {
"supplier_matchcode": "SMPE",
"article_number": "CS1342",
"description": "Fuel Parts",
"url": "",
"len": 6,
"label": "Sensor",
"version": 1,
"supplier_cname": "",
"supplier": "SMPE",
"group": "",
"replace_numbers": "",
"utility_number": ""
}
}
]
}
```
but tornado-es update will add a new attribute to the document ,just like below
```
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "brand",
"_type": "part",
"_id": "CS1342",
"_score": 1,
"_source": {
"supplier_matchcode": "SMPE",
"article_number": "CS1342",
"description": "Fuel Parts",
"url": "",
"len": 6,
"label": "Sensor",
"version": 0,
"supplier_cname": "",
"supplier": "SMPE",
"group": "",
"replace_numbers": "",
"utility_number": "",
"script": "ctx._source.version+=1"
}
}
]
}
```
and this is my update code
```
from tornadoes import ESConnection
self.es = ESConnection()
self.es.update(index=mona.index,type='part',uid=mona.param['id'],contents=mona.body,callback=self.callback)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.