在elasticsearch 1.1.1中,我试图获取搜索操作组收集的统计数据。
在documentation中,您可以在搜索时为搜索操作设置自定义组,然后您可以使用stats 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
}
}
}
}
}
我看到stats有效负载中没有任何关于我的组的痕迹。我在requert中没有我的小组得到完全相同的结果:curl -XGET http://host:9200/myIndex/_stats/search
您知道如何检索group1和group2的统计信息吗?
我的弹性搜索版本:
{
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"
}