elasticsearch,Json,elasticsearch" /> elasticsearch,Json,elasticsearch" />

Json 使用PHP库在ElasticSearch中仅获取结果文档,不包括其他元数据

Json 使用PHP库在ElasticSearch中仅获取结果文档,不包括其他元数据,json,elasticsearch,Json,elasticsearch,我当前的查询结果如下 { "took": 13, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 1, "max_score": 1, "hits": [ { "_index": "ABC", "_type": "users",

我当前的查询结果如下

{
"took": 13,
"timed_out": false,
"_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
},
"hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
        {
            "_index": "ABC",
            "_type": "users",
            "_id": "1",
            "_score": 1,
            "fields": {
                "partial1": {
                    "uid": "1",
                    "pic": "21398129082209.jpg",
                    "utype": "m",
                    "user": "John Smith"
                }
            }
        }
    ]
}
}
每秒在不同的1000个查询中返回的点击数超过100000次

我想从我的结果中排除其他元数据信息,特别是\u indextype,因为我正在使用PHP库检索文档并将其发送给客户端。因此,这会向客户端公开我的索引类型,这可能是安全问题。目前我正在循环通过结果,如

 $ttl = count($results['hits']['hits']);
 $lst = array();
 for($i=0; $i<$ttl; $i++)
 {
  $lst[] = $results['hits']['hits'][$i]["fields"]["partial1"];
 }
$ttl=count($results['hits']['hits']);
$lst=array();
对于($i=0;$i使用“filter\u path”查询参数。它非常灵活。例如,要仅为所有结果包含_source字段(从而排除响应中的所有其他元数据),请使用:
?filter\u path=hits.hits._source
。我认为它从1.6开始就在rest api中


在ES中没有直接执行此操作的方法。您需要执行您正在执行的操作。您是否100%确定这一点(哇@DrTech Clinton我刚刚访问了你的个人资料,看到你在ElasticSearch.com工作。太好了,我得到了100%的答案。@DrTech Hi,已经一年多了,有很多问题/请求能够在不牺牲性能的情况下过滤出元数据。这仍然是100%不可能的吗?Tnx:)