Performance about api between http api and java api?

I want to partial update doc,but i also want a good performace,so I tried 2 way to test ,one is by http rest api,the other is by java api version0.90;
java_version:1.6.20
es_version:0.90.1

HTTP REST:
http://127.0.0.1:9200/_bulk

{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141307986"}} /n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-06-27","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}} /n
{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141308091"}} /n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-12-26","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}} /n

JAVA API:

bulkRequest.add(client.prepareUpdate(indexName, indexTypeName,key).setUpsertRequest(builder.endObject()).setScript(updateScript.toString()).setFields("_source"));
BulkResponse bulkResponse = bulkRequest.execute().actionGet();

Here is the test result:
http rest:
bulk nums:8000,cost time:1306
bulk nums:8000,cost time:1348
bulk nums:8000,cost time:1320
bulk nums:8000,cost time:1277
bulk nums:8000,cost time:1214
bulk nums:8000,cost time:1336
bulk nums:8000,cost time:1338
bulk nums:8000,cost time:1399
bulk nums:8000,cost time:1231
bulk nums:8000,cost time:1280
bulk nums:8000,cost time:1482
bulk nums:8000,cost time:1248
bulk nums:8000,cost time:1394

java api:
bulkResponse items8000,cost time:5252
bulkResponse items8000,cost time:5171
bulkResponse items8000,cost time:5077
bulkResponse items8000,cost time:5230
bulkResponse items8000,cost time:5469
bulkResponse items8000,cost time:5898
bulkResponse items8000,cost time:5443
bulkResponse items8000,cost time:5579
bulkResponse items8000,cost time:5026
bulkResponse items8000,cost time:5279
bulkResponse items8000,cost time:5851
bulkResponse items8000,cost time:5708
bulkResponse items8000,cost time:5115

So why is java api way so slower than http?
And How can I slove it?I read l a lot doc,but can't found the answer.

What do you have in updateScript?

Sounds like you were not using script with HTTP REST requests.

David

Le 16 oct. 2014 à 04:28, Charles Chou zouxcs@gmail.com a écrit :

I want to partial update doc,but i also want a good performace,so I tried 2 way to test ,one is by http rest api,the other is by java api version0.90;
java_version:1.6.20
es_version:0.90.1

HTTP REST:
http://127.0.0.1:9200/_bulk

{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141307986"}} /n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-06-27","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}} /n
{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141308091"}} /n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-12-26","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}} /n

JAVA API:

bulkRequest.add(client.prepareUpdate(indexName, indexTypeName,key).setUpsertRequest(builder.endObject()).setScript(updateScript.toString()).setFields("_source"));
BulkResponse bulkResponse = bulkRequest.execute().actionGet();

Here is the test result:
http rest:
bulk nums:8000,cost time:1306
bulk nums:8000,cost time:1348
bulk nums:8000,cost time:1320
bulk nums:8000,cost time:1277
bulk nums:8000,cost time:1214
bulk nums:8000,cost time:1336
bulk nums:8000,cost time:1338
bulk nums:8000,cost time:1399
bulk nums:8000,cost time:1231
bulk nums:8000,cost time:1280
bulk nums:8000,cost time:1482
bulk nums:8000,cost time:1248
bulk nums:8000,cost time:1394

java api:
bulkResponse items8000,cost time:5252
bulkResponse items8000,cost time:5171
bulkResponse items8000,cost time:5077
bulkResponse items8000,cost time:5230
bulkResponse items8000,cost time:5469
bulkResponse items8000,cost time:5898
bulkResponse items8000,cost time:5443
bulkResponse items8000,cost time:5579
bulkResponse items8000,cost time:5026
bulkResponse items8000,cost time:5279
bulkResponse items8000,cost time:5851
bulkResponse items8000,cost time:5708
bulkResponse items8000,cost time:5115

So why is java api way so slower than http?
And How can I slove it?I read l a lot doc,but can't found the answer.

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/0d152ecb-d141-483b-a0ef-48b7f6bcc11a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/4A44464D-AB1C-4385-ADDC-8BC2DC5B49BF%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

yeah,I found this also can partial update the doc.
but when I change the doc to script int http rest ,I found this way
couldn't finish the update successfully

On Thursday, October 16, 2014 2:29:08 PM UTC+8, David Pilato wrote:

What do you have in updateScript?

Sounds like you were not using script with HTTP REST requests.

David

Le 16 oct. 2014 à 04:28, Charles Chou <zou...@gmail.com <javascript:>> a
écrit :

I want to partial update doc,but i also want a good performace,so I tried
2 way to test ,one is by http rest api,the other is by java api
version0.90;
java_version:1.6.20
es_version:0.90.1

HTTP REST:
http://127.0.0.1:9200/_bulk

{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141307986"}}
/n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-06-27","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}}
/n
{"update":{"_index":"mobile","_type":"mobile_property_mid","_id":"15141308091"}}
/n
{"doc":{"consume_vol_tot":"0.0","last_login_date":"2012-12-26","login_days_3month":"0","log_avg_interval_half_year":"0.0","consume_days_3month":"0"}}
/n

JAVA API:

bulkRequest.add(client.prepareUpdate(indexName,
indexTypeName,key).setUpsertRequest(builder.endObject()).setScript(updateScript.toString()).setFields("_source"));
BulkResponse bulkResponse = bulkRequest.execute().actionGet();

Here is the test result:
http rest:
bulk nums:8000,cost time:1306
bulk nums:8000,cost time:1348
bulk nums:8000,cost time:1320
bulk nums:8000,cost time:1277
bulk nums:8000,cost time:1214
bulk nums:8000,cost time:1336
bulk nums:8000,cost time:1338
bulk nums:8000,cost time:1399
bulk nums:8000,cost time:1231
bulk nums:8000,cost time:1280
bulk nums:8000,cost time:1482
bulk nums:8000,cost time:1248
bulk nums:8000,cost time:1394

java api:
bulkResponse items8000,cost time:5252
bulkResponse items8000,cost time:5171
bulkResponse items8000,cost time:5077
bulkResponse items8000,cost time:5230
bulkResponse items8000,cost time:5469
bulkResponse items8000,cost time:5898
bulkResponse items8000,cost time:5443
bulkResponse items8000,cost time:5579
bulkResponse items8000,cost time:5026
bulkResponse items8000,cost time:5279
bulkResponse items8000,cost time:5851
bulkResponse items8000,cost time:5708
bulkResponse items8000,cost time:5115

So why is java api way so slower than http?
And How can I slove it?I read l a lot doc,but can't found the answer.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0d152ecb-d141-483b-a0ef-48b7f6bcc11a%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0d152ecb-d141-483b-a0ef-48b7f6bcc11a%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/92345cac-5274-436a-be12-90b92a99e406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.