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

  • 相关阅读:
    UML 类图基础知识记录
    装饰器模式
    Hive 安装配置记录
    HBase 建表新增数据记录
    HBase 安装过程记录
    lucene 索引参数配置类IndexWriterConfig记录
    lucene 专业名词作用整理
    socket、webService、RMI ?
    Lucene 对文档打分的规则整理记录
    lucene 检索流程整理笔记
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350300.html
Copyright © 2011-2022 走看看