在elasticsearch 1.1.1中,我正在尝试通过搜索操作组收集统计信息。
在文档中,据说您可以在搜索操作的搜索时间设置自定义组,然后您可以使用统计信息API从这些组中获取统计信息。
在这里我在现有的MyIndex索引上所做的工作:
> curl -XGET http://host:9200/myIndex/myType/_search -d '{
"size":1,"query":{"match_all":{}},"stats":["group1","group2"]}'
{
"_shards": {
"failed": 0,
"successful": 5,
"total": 5
},
"hits": {
"hits": [
{[...]}
],
"max_score": 1.0,
"total": 52
},
"timed_out": false,
"took": 1
}
一段时间后,我得到了统计信息:
> curl -XGET http://host:9200/myIndex/_stats/search?groups=group1,group2
{
"_all": {
"primaries": {
"search": {
"fetch_current": 0,
"fetch_time_in_millis": 5676,
"fetch_total": 2468,
"open_contexts": 0,
"query_current": 0,
"query_time_in_millis": 31166,
"query_total": 4530
}
},
"total": {
"search": {
"fetch_current": 0,
"fetch_time_in_millis": 5676,
"fetch_total": 2468,
"open_contexts": 0,
"query_current": 0,
"query_time_in_millis": 31166,
"query_total": 4530
}
}
},
"_shards": {
"failed": 0,
"successful": 5,
"total": 10
},
"indices": {
"myIndex": {
"primaries": {
"search": {
"fetch_current": 0,
"fetch_time_in_millis": 5676,
"fetch_total": 2468,
"open_contexts": 0,
"query_current": 0,
"query_time_in_millis": 31166,
"query_total": 4530
}
},
"total": {
"search": {
"fetch_current": 0,
"fetch_time_in_millis": 5676,
"fetch_total": 2468,
"open_contexts": 0,
"query_current": 0,
"query_time_in_millis": 31166,
"query_total": 4530
}
}
}
}
}
我在统计数据有效载荷中看不到我的组的任何痕迹。我没有在要求的情况下得到完全相同的结果:curl -XGET http://host:9200/myIndex/_stats/search
您知道如何检索group1和group2的统计信息吗?
我的Elasticsearch版本:
{
status: 200,
name: "myclustername",
version: {
number: "1.1.1",
build_hash: "f1585f096d3f3985e73456debdc1a0745f512bbc",
build_timestamp: "2014-04-16T14:27:12Z",
build_snapshot: false,
lucene_version: "4.7"
},
tagline: "You Know, for Search"
}
这是1.1.1中的一个错误,该错误已固定在1.3.0中。