[Pls]how to use doc to update json object, There is some exception


(xjj210130) #1

I use update to update json object, this is some wrong.Please help me.

1,I insert a log to es.
curl -XPOST 'localhost:9200/12/1/3/_update' -d
'{"doc":{"price":[{"costprice":1,"icsonprice":1,"name":"1123","pid":1,"pricetype":1,"purchaseprice":1,"shipmentprice":1}],"product":{"status":2330,"type":120}}}'

2: I use api to call update with c++, like the following:
1007/47/12/_update
{"doc":{"price":[{"costprice":10,"icsonprice":10,"name":"1123","pid":10,"pricetype":10,"purchaseprice":18,"shipmentprice":19}]}}

3:This is the wrong message as following:
[Amanda Sefton] Caught exception while handling client http traffic,
closing connection [id: 0x3c9f560c, /10.12.194.116:52545 :>
/10.12.194.116:9200]
java.lang.IllegalArgumentException: invalid version format:
1007/47/12/_UPDATE

?{"DOC":{"PRICE":[{"COSTPRICE":10,"ICSONPRICE":10,"NAME":"1123","PID":10,"PRICETYPE":10,"PURCHASEPRICE":18,"SHIPMENTPRICE":19}]}}
at
org.elasticsearch.common.netty.handler.codec.http.HttpVersion.(HttpVersion.java:102)
at
org.elasticsearch.common.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:62)
at
org.elasticsearch.common.netty.handler.codec.http.HttpRequestDecoder.createMessage.

4: if i use curl like the following, there is no error, it works right.
curl -XPOST localhost:9200/12/1/3/_update -d '{
"doc" : {
"price" :
[{"costprice":20,"icsonprice":99,"name":"icson","pid":35,"pricetype":2,"purchaseprice":900,"shipmentprice":99}],
"product":
{
"type":121,
"status":141
}
}
}'

so, should i how to do it? Thanks very much.

--
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/3825e71c-0b3f-41f8-b944-0e2dded9ba7d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

Is it possible that you have a different Java version from your development
machine and the ES server?

--
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/e3df0aee-164f-4be4-871f-55c7d8b51825%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3