【发布时间】:2016-02-16 04:27:40
【问题描述】:
我当前的查询结果为
{
"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 次点击。
我想从我的结果中排除其他元数据信息,特别是 _index 和 type,因为我正在使用 PHP 库检索文档并将其发送给客户端。因此,这会将我的 Index 和 type 暴露给客户,这可能是安全问题。目前我正在循环遍历结果,例如
$ttl = count($results['hits']['hits']);
$lst = array();
for($i=0; $i<$ttl; $i++)
{
$lst[] = $results['hits']['hits'][$i]["fields"]["partial1"];
}
如果同时有数千个请求,这就是性能问题。并且在客户键入内容时将结果文档发送给客户需要尽可能快。有什么出路吗?有一个关于 SO 的问题,但大约有一年的历史,并表示目前不支持。还是我只需要做我正在做的事?
【问题讨论】:
-
没有办法直接在 ES 中执行此操作。你需要做你已经在做的事情。
-
您对此有 100% 的把握吗? :(
-
WOW @DrTech Clinton 我刚刚访问了您的个人资料,看到您在 ElasticSearch.com 工作。太好了,我得到了 100% 的回答。
-
@DrTech 嗨,已经一年多了,有很多问题/请求能够在不牺牲性能的情况下过滤掉元数据。这仍然是100%不可能吗? Tnx :)
标签: json elasticsearch