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"]
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"]