使用bulk批量操作數(shù)據(jù)庫
隴南網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項目制作,到程序開發(fā),運(yùn)營維護(hù)。成都創(chuàng)新互聯(lián)公司自2013年起到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)公司。
格式:
{"index":{"_index":"home","_type":"home",""_id":"2"}}
{"id": 2, "location": "南京市棲霞區(qū)馬群街道29號", "money": 3000, "area":80, "type": "三居室", "style": "整租"}
第一行指定請求與索引和類型,可以選擇的請求有"create","index","delete","ubdate",
"_index"指定索引名,"_type"指定類型名,"_id"指定id
第二行指定插入的內(nèi)容.
如request.json:
{"index":{"_index":"home","_type":"home","_id":"2"}}
{"id": 2, "location": "南京市棲霞區(qū)馬群街道29號", "money": 3000, "area":80, "type": "三居室", "style": "整租"}
{"index":{"_index":"home","_type":"home","_id":"3"}}
{"id": 3, "location": "南京市玄武區(qū)山西路門路29號", "money": 400, "area":15, "type": "四居室", "style": "合租"}
{"index":{"_index":"home","_type":"home","_id":"4"}}
{"id": 4, "location": "南京市秦淮區(qū)山北京東路29號", "money": 500, "area":14, "type": "三居室", "style": "合租"}
{"index":{"_index":"home","_type":"home","_id":"5"}}
{"id": 5, "location": "南京市秦淮區(qū)新街口29號", "money": 450, "area":16, "type": "四居室", "style": "合租"}
在數(shù)據(jù)庫根目錄執(zhí)行:
curl -XPUT 'localhost:9200/_bulk' -H "Content-Type: application/json" --data-binary @request.json