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'

delete whole index
curl -XDELETE 10.58.90.167:9200/testindex

Add one entry
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"}'

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

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

Get all entries by index
curl -XGET '10.58.90.167:9200/testindex/_search?pretty=true'

Update one entry by Id
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}'

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

data from curl_new_1523522348174.json (remember a new line in the end)
{"buildScanLink":"http://mo-73ef27e27.mo.sap.corp/s/5cprhgv3jemcc"}
{"index":{"_id":"tg5hqjjp55fiw"}}
{"buildScanLink":"http://mo-73ef27e27.mo.sap.corp/s/tg5hqjjp55fiw"}
{"index":{"_id":"sdujonezg7rcu"}}

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

data from curl_update_test.json (remember a new line in the end)
{"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":"trunk sfmessages"}}
{"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":"jenkins b1802 employeeprofilepoc"}}

Create Scripted Field: buildTime
doc["buildTimeInMillis"]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值