zoukankan      html  css  js  c++  java
  • ElasticSearch _bulk和_mget

    _bulk api

    POST /_bulk

    批量操作

    POST _bulk
    { "index" : { "_index" : "movies", "_id" : "1" } }
    { "year" : 1994 }
    { "delete" : { "_index" : "movies", "_id" : "1" } }
    { "delete" : { "_index" : "movies1", "_id" : "1" } }
    { "create" : { "_index" : "movies", "_id" : "1" } }
    { "year" : "1994" }
    { "update" : {"_id" : "1", "_index" : "movies"} }
    { "doc" : {"name" : "1"} }
    

    POST //_bulk

    批量操作 指定索引

    POST movies/_bulk
    { "index" : {  "_id" : "2" } }
    { "year" : 1994 }
    { "delete" : {  "_id" : "2" } }
    { "create" : { "_id" : "2" } }
    { "year" : "19924" }
    { "update" : {"_id" : "2"} }
    { "doc" : {"name" : "XXXX2"} }
    

    _mget

    GET /_mget 和 GET //_mget

    简单的根据id 查找
    GET _mget
    {
      "docs":[
        {
          "_index":"movies",
          "_id":1
        },  {
          "_index":".kibana-event-log-7.10.2-000001",
          "_id":1
        }
        ]
    }
    
    结果:
    {
      "docs" : [
        {
          "_index" : "movies",
          "_type" : "_doc",
          "_id" : "1",
          "_version" : 16,
          "_seq_no" : 9779,
          "_primary_term" : 10,
          "found" : true,
          "_source" : {
            "year" : "1994",
            "name" : "1"
          }
        },
        {
          "_index" : ".kibana-event-log-7.10.2-000001",
          "_type" : "_doc",
          "_id" : "1",
          "found" : false
        }
      ]
    } 
    
    筛选源
    GET _mget
    {
      "docs":[
        {
          "_index":"movies",
          "_id":1,
          "_source":["year"]
        },
        {
          "_index":"movies",
          "_id":15061,
          "_source": {
            "include": [ "year","user" ],
            "exclude": [ "user.full_name" ]
          }
        }
      ]
    }
    
    结果
    {
      "docs" : [
        {
          "_index" : "movies",
          "_type" : "_doc",
          "_id" : "1",
          "_version" : 16,
          "_seq_no" : 9779,
          "_primary_term" : 10,
          "found" : true,
          "_source" : {
            "year" : "1994"
          }
        },
        {
          "_index" : "movies",
          "_type" : "_doc",
          "_id" : "15061",
          "_version" : 1,
          "_seq_no" : 9784,
          "_primary_term" : 10,
          "found" : true,
          "_source" : {
            "year" : 1994,
            "user" : {
              "last_name" : "jiayue",
              "first_name" : "bi"
            }
          }
        }
      ]
    }
    
    
    
  • 相关阅读:
    论频谱中负频率成分的物理意义(转载)
    VS2008的glaux库
    通过域名显示IP列表
    Shader errorX3205的解决
    Curl, Divergence, Circulation
    关于FIONREAD命令的作用
    Cairngorm的结构及开发使用(2)(转)
    结合Flex Builder和Flash CS4制作一个中国地图的应用(转)
    大型高并发高负载网站的系统架构(转)
    Cairngorm的结构及开发使用(4)(转)
  • 原文地址:https://www.cnblogs.com/roinbi/p/14515674.html
Copyright © 2011-2022 走看看