Elasticsearch日志说明

时间:2013-07-23 06:07:02

标签: logging request elasticsearch

我已经为我的elasticsearch服务器启用了慢速日志,以查看我获得的流量。
以下是一些示例输出:

[2013-07-23 06:10:45,213][WARN ][index.search.slowlog.query] [Afari, Jamal] [index_3559_schema1][4] took[107.5micros], took_millis[0], types[some_type], stats[], search_type[QUERY_THEN_FETCH], total_shards[195], source[{"query":{"query_string":{"query":"*"}},"from":0,"size":"24","sort":{"updated_at":"desc"}}], extra_source[],
[2013-07-23 06:10:45,214][WARN ][index.search.slowlog.query] [Afari, Jamal] [index_3559_schema1][3] took[155.6micros], took_millis[0], types[some_type], stats[], search_type[QUERY_THEN_FETCH], total_shards[195], source[{"query":{"query_string":{"query":"*"}},"from":0,"size":"24","sort":{"updated_at":"desc"}}], extra_source[],
[2013-07-23 06:10:45,214][WARN ][index.search.slowlog.query] [Afari, Jamal] [index_3559_schema1][2] took[107.7micros], took_millis[0], types[some_type], stats[], search_type[QUERY_THEN_FETCH], total_shards[195], source[{"query":{"query_string":{"query":"*"}},"from":0,"size":"24","sort":{"updated_at":"desc"}}], extra_source[],
...
[2013-07-22 15:10:45,260][WARN ][index.search.slowlog.fetch] [Afari, Jamal] [index_42044_schema1][3] took[85.3micros], took_millis[0], types[some_type], stats[], search_type[QUERY_THEN_FETCH], total_shards[195], source[{"query":{"query_string":{"query":"*"}},"from":0,"size":"24","sort":{"updated_at":"desc"}}], extra_source[],

这些行中的每一行是否都表示(index_3559_schema1, index_3559_schema1, index_3559_schema1)我有一个单独的HTTP请求?

index.search.slowlog.queryindex.search.slowlog.fetch之间的区别是什么?

1 个答案:

答案 0 :(得分:3)

慢速日志不会在分片级别上引用http请求,而是引用查询。这意味着,如果查询由5个分片组成的索引,则在同一查询的日志5条目中,每个分片一个,具有不同的分片ID,这是在索引名称后面显示的数字。这样,您就可以监视每个分片的每个查询的执行情况。

获取行指的是获取阶段。默认情况下使用query_then_fetch search type,这意味着如果查询由5个主分片组成的索引(让我们假设0副本使其更简单),则将在每个分片上执行查询,该分片将仅返回相关信息,如文档ID及其分数。您使用搜索请求命中的节点将减少这些结果,以便仅返回最高结果。在标识需要返回哪些文档的reduce部分之后,然后仅从它们的分片中获取那些相关文档。那是你在慢速日志中看到获取阶段的时候。