Elasticsearch

Init

curl-XPUT'10.58.90.167:9200/last/timestamp/1?pretty'-H'Content-Type:application/json'-d'{"lastTimestamp":1522663124911}'

curl-XGET'10.58.90.167:9200/last/timestamp/1?pretty'

curl-XPUT'10.58.90.167:9200/last/timestamp/1?pretty'-H'Content-Type:application/json'-d'{"lastTimestamp":1234567}'

curl-XGET'10.58.90.167:9200/testindex?pretty'

deletewholeindex

curl-XDELETE10.58.90.167:9200/testindex

Addoneentry

curl-XPOST'10.58.90.167:9200/testindex/testtype'-H'Content-Type:application/json'-d'{"buildScanId":"http://mo-73ef27e27.mo.sap.corp/s/rewoxscxx2wji"}'

curl-XPOST'10.58.90.167:9200/testindex/testtype/iszndr6gusg6e?pretty'-H'Content-Type:application/json'-d'{"buildScanLink":"http://mo-73ef27e27.mo.sap.corp/s/rewoxscxx2wji"}'

GetbybuildScanId

curl-XGET'10.58.90.167:9200/testindex/_search?q=buildScanId:ty7ukn6a3c72c&pretty'

GetbyId

curl-XGET'10.58.90.167:9200/testindex/testtype/ty7ukn6a3c72c?pretty'

Getallentriesbyindex

curl-XGET'10.58.90.167:9200/testindex/_search?pretty=true'

UpdateoneentrybyId

curl-XPOST'10.58.90.167:9200/testindex/testtype/iszndr6gusg6e/_update'-H'Content-Type:application/json'-d'{"doc":{"key1":"value1","key2":"value2"}}'

curl-XPUT'10.58.90.167:9200/last/timestamp/1?pretty'-H'Content-Type:application/json'-d'{"lastTimestamp":1523522348174}'

Newbulkadd

curl-H'Content-Type:application/x-ndjson'-XPOST'10.58.90.167:9200/testindex/testtype/_bulk'--data-binary@curl_new_1523522348174.json

datafromcurl_new_1523522348174.json(rememberanewlineintheend)

{"buildScanLink":"http://mo-73ef27e27.mo.sap.corp/s/5cprhgv3jemcc"}

{"index":{"_id":"tg5hqjjp55fiw"}}

{"buildScanLink":"http://mo-73ef27e27.mo.sap.corp/s/tg5hqjjp55fiw"}

{"index":{"_id":"sdujonezg7rcu"}}

bulkupdate

curl-H'Content-Type:application/x-ndjson'-XPOST10.58.90.167:9200/testindex/testtype/_bulk--data-binary@curl_update_test.json

datafromcurl_update_test.json(rememberanewlineintheend)

{"update":{"_id":"vtogrpn5w56po"}}

{"doc":{"gradleVersion":"4.5","pluginVersion":"1.11","buildTime":1523265004679,"user":"jenkins","hostname":"build7","tasks":"buildFinal","project":"SFV4_idl-sfmessages_PR-1745-KMB7Q2EYNAFLRXWREQB7LV2KR5XVQYE5P43KLSV4A3645YYLGHWQ","isBuildSuccessful":true,"duration":9,"tags":"trunksfmessages"}}

{"update":{"_id":"hjolb6l63sdvo"}}

{"doc":{"gradleVersion":"4.2","pluginVersion":"1.8","buildTime":1523265010367,"user":"jenkins","hostname":"build6","project":"au-employeeprofilepoc-b1802","tasks":"buildFinal","isBuildSuccessful":true,"duration":145,"tags":"jenkinsb1802employeeprofilepoc"}}

CreateScriptedField:buildTime

doc["buildTimeInMillis"]

相关推荐