• Elasticsearch之CURL命令的bulk批量操作


       大家,也可去看看我下面的博客

    Elasticsearch之批量操作bulk

       官网上,是举例了新建一个requests文件。

     

    [hadoop@master elasticsearch-2.4.0]$ pwd
    /home/hadoop/app/elasticsearch-2.4.0
    [hadoop@master elasticsearch-2.4.0]$ ll
    total 48
    drwxrwxr-x 2 hadoop hadoop  4096 Apr 21 14:19 bin
    drwxrwxr-x 3 hadoop hadoop  4096 Jun 30 09:33 config
    drwxrwxr-x 2 hadoop hadoop  4096 Apr 21 14:19 lib
    -rw-rw-r-- 1 hadoop hadoop 11358 Aug 24  2016 LICENSE.txt
    drwxrwxr-x 5 hadoop hadoop  4096 Aug 29  2016 modules
    -rw-rw-r-- 1 hadoop hadoop   150 Aug 24  2016 NOTICE.txt
    drwxrwxr-x 5 hadoop hadoop  4096 Apr 22 08:49 plugins
    -rw-rw-r-- 1 hadoop hadoop  8700 Aug 24  2016 README.textile
    [hadoop@master elasticsearch-2.4.0]$ vim requests

     

    { "index" : { "_index" : "zhouls", "_type" : "user", "_id" : "6" } }
    { "name" : "mayun" , "age" : "51" }
    { "update" : { "_index" : "zhouls", "_type" : "user", "_id" : "6" } }
    { "doc" : { "age" : 52 }}

      然后,执行批量操作

    [hadoop@master elasticsearch-2.4.0]$ pwd
    /home/hadoop/app/elasticsearch-2.4.0
    [hadoop@master elasticsearch-2.4.0]$ ll
    total 52
    drwxrwxr-x 2 hadoop hadoop  4096 Apr 21 14:19 bin
    drwxrwxr-x 3 hadoop hadoop  4096 Jun 30 09:33 config
    drwxrwxr-x 2 hadoop hadoop  4096 Apr 21 14:19 lib
    -rw-rw-r-- 1 hadoop hadoop 11358 Aug 24  2016 LICENSE.txt
    drwxrwxr-x 5 hadoop hadoop  4096 Aug 29  2016 modules
    -rw-rw-r-- 1 hadoop hadoop   150 Aug 24  2016 NOTICE.txt
    drwxrwxr-x 5 hadoop hadoop  4096 Apr 22 08:49 plugins
    -rw-rw-r-- 1 hadoop hadoop  8700 Aug 24  2016 README.textile
    -rw-rw-r-- 1 hadoop hadoop   201 Jul  1 11:25 requests
    [hadoop@master elasticsearch-2.4.0]$ cat requests 
    { "index" : { "_index" : "zhouls", "_type" : "user", "_id" : "6" } }
    { "name" : "mayun" , "age" : "51" }
    { "update" : { "_index" : "zhouls", "_type" : "user", "_id" : "6" } }
    { "doc" : { "age" : 52 }}
    [hadoop@master elasticsearch-2.4.0]$ curl -XPOST http://master:9200/_bulk --data-binary @requests
    {"took":506,"errors":false,"items":[{"index":{"_index":"zhouls","_type":"user","_id":"6","_version":1,"_shards":{"total":2,"successful":2,"failed":0},"status":201}},{"update":{"_index":"zhouls","_type":"user","_id":"6","_version":2,"_shards":{"total":2,"successful":2,"failed":0},"status":200}}]}[hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 
    [hadoop@master elasticsearch-2.4.0]$ 

       得到

    官网

    https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

  • 相关阅读:
    UVA 11235 (游程编码+ST算法)
    CodeForces 359D (数论+二分+ST算法)
    线性动态规划
    AC自动机
    KMP
    字典树
    Treap和名次树
    线段树
    最小生成树
    【VS】使用vs2017自带的诊断工具(Diagnostic Tools)诊断程序的内存问题
  • 原文地址:https://www.cnblogs.com/zlslch/p/7101820.html
Copyright © 2020-2023  润新知