【发布时间】:2016-10-18 14:30:35
【问题描述】:
我正在使用 logstash 来分析我的 Web 服务器访问。在这个时候,它工作得很好。我使用了一个配置文件,它为我产生了这种数据:
{
"type": "apache_access",
"clientip": "192.243.xxx.xxx",
"verb": "GET",
"request": "/publications/boreal:12345?direction=rtl&language=en",
...
"url_path": "/publications/boreal:12345",
"url_params": {
"direction": "rtl",
"language": "end"
},
"object_id": "boreal:12345"
...
}
此记录存储在“logstash-2016.10.02”索引中(每天一个索引)。 我还创建了另一个名为“publications”的索引。此索引包含发布元数据。 json 记录如下所示:
{
"type": "publication",
"id": "boreal:12345",
"sm_title": "The title of the publication",
"sm_type": "thesis",
"sm_creator": [
"Smith, John",
"Dupont, Albert",
"Reegan, Ronald"
],
"sm_departement": [
"UCL/CORE - Center for Operations Research and Econometrics",
],
"sm_date": "2001",
"ss_state": "A"
...
}
我想创建一个查询,例如 “授予我所有访问 'Smith, John' 出版物的权限”。 由于我所有的数据都没有进入同一个索引,我不能使用父子关系(我是对的吗?) 我在论坛上读到了这篇文章,但这是一篇旧文章:
By limiting itself to parent/child type relationships elasticsearch makes life
easier for itself: a child is always indexed in the same shard as its parent,
so has_child doesn’t have to do awkward cross shard operations.
使用logstash,我不能将所有数据放在一个名为logstash 的索引中。按月我有超过 100 万的访问量......在 1 年内,我将有超过 1500 万条记录到 1 个索引中......我需要将网络访问数据存储至少 5 年(1M * 12 * 15 = 180M) . 我认为处理包含超过 18M 记录的单个索引不是一个好主意(如果我错了,请告诉我)。
我的问题是否存在解决方案?我没有找到任何漂亮的解决方案。 这次我的python脚本中唯一的一个是:第一个查询收集关于'Smith,John'出版物的所有id;每个发布的循环以获取此特定发布的所有 WebServer 访问权限。 因此,如果“Smith, John”有 321 个出版物,我向 ES 发送了 312 个 http 请求,并且响应时间不可接受(超过 7 秒;当您知道 ES 中的记录数但最终用户无法接受时,这还不错。 )
感谢您的帮助;对不起我的英语
雷诺
【问题讨论】: