zoukankan      html  css  js  c++  java
  • 06_Elasticsearch 批量获取mget

    06_Elasticsearch 批量获取mget
    
    现在有:
    
    http://192.168.32.81:9200/bank/bank_account/1
    
    http://192.168.32.81:9200/bank/bank_account/2
    
    http://192.168.32.81:9200/bank/bank_account/3
    
    http://192.168.32.81:9200/bank/bank_account/4
    
    http://192.168.32.81:9200/_mget/
                                 POST
    {
      "docs":[
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":1
    },
    
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":2
    },
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":3
      } 
     ]
    }
    
    
    返回:
    {
    
        "docs": [
            {
                "_index": "bank",
                "_type": "bank_account",
                "_id": "1",
                "_version": 1,
                "found": true,
                "_source": {
                    "title": "Elasticsearch:The scan",
                    "name": {
                        "first": "aaa",
                        "last": "bbb"
                    },
                    "publish_date": "2016-09-06",
                    "price": "49"
                }
            }
            ,
            {
                "_index": "bank",
                "_type": "bank_account",
                "_id": "2",
                "_version": 1,
                "found": true,
                "_source": {
                    "title": "Elasticsearch:The scan",
                    "name": {
                        "first": "aaa",
                        "last": "bbb"
                    },
                    "publish_date": "2016-09-06",
                    "price": "59"
                }
            }
            ,
            {
                "_index": "bank",
                "_type": "bank_account",
                "_id": "3",
                "_version": 1,
                "found": true,
                "_source": {
                    "title": "Elasticsearch:The scan",
                    "name": {
                        "first": "aaa",
                        "last": "bbb"
                    },
                    "publish_date": "2016-09-06",
                    "price": "69"
                }
            }
        ]
    
    }
    
    
    获取某个字段:
    {
      "docs":[
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":1,
          "_source":"price"
    },
    
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":2,
           "_source":"price"
    },
         {
          "_index":"bank",
          "_type":"bank_account",
          "_id":3,
    "_source":"price"
      } ,
       {
          "_index":"bank",
          "_type":"bank_account",
          "_id":4,
    "_source":"price"
      } 
     ]
    }
    

  • 相关阅读:
    explain组合索引是否命中
    高并发优化
    docker基础篇一
    Web API 集成Serilog
    复习一下CSS,做笔记记录一下
    Process调用winform程序
    winform自动更新
    格式化xml 给没有节点的内容添加节点
    2.Grpc消息定义
    1.Grpc环境配置
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350300.html
Copyright © 2011-2022 走看看