从单个数组中的Elasticsearch中的索引获取特定字段值

时间:2019-05-02 10:41:23

标签: elasticsearch

弹性搜索和查询中的索引结构。

{  
   "datapoints":{  
      "FF":"80.32",
      "SC":"12.12312423",
      "SE":"12.1234545",
      "SD":"15.12312423",
      "Isc":"9.74353896",
      "WE":"7.12312423"
   },
   "creationdate":"08/05/2015"
}


{   "size":"10",
    "_source": ["datapoints.FF", "datapoints.Isc"],
    "query": {
        "match_all":{}
    }
}

上面查询的响应显示:

{
    "hits": {
        "hits": [
            {
                "_score": 1.0, 
                "_type": "measuring", 
                "_id": "4904a081109c81d3d30c5c05c299f62b", 
                "_source": {
                    "datapoints": {
                        "Isc": 9.74353896, 
                        "FF": 80.37
                    }
                }, 
                "_index": "a-123"
            }, 
            {
                "_score": 1.0, 
                "_type": "measuring", 
                "_id": "8d4d6e3b2cd114c12fc6f66b08ccd7f0", 
                "_source": {
                    "datapoints": {
                        "Isc": 9.73291772, 
                        "FF": 80.76
                    }
                }, 
                "_index": "a-123"
            }
            }
}

如何查询弹性搜索以仅获取数组中选定的特定字段值?我想让自己像这样。

"_source": {
                    "FF": {80.32,12.56,123.4534,12.34,.....so on

                    }
                }

0 个答案:

没有答案