浏览代码

Update histogram-aggregation docs (#96974)

* Update histogram-aggregation

* Little tweak

* Update docs/reference/aggregations/bucket/histogram-aggregation.asciidoc

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>

* Update docs/reference/aggregations/bucket/histogram-aggregation.asciidoc

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>

* Add test

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
Philipp Kahr 2 年之前
父节点
当前提交
4ccc5a9c8c
共有 1 个文件被更改,包括 22 次插入4 次删除
  1. 22 4
      docs/reference/aggregations/bucket/histogram-aggregation.asciidoc

+ 22 - 4
docs/reference/aggregations/bucket/histogram-aggregation.asciidoc

@@ -332,7 +332,25 @@ with latency metrics (in milliseconds) for different networks:
 
 
 [source,console]
 [source,console]
 --------------------------------------------------
 --------------------------------------------------
-PUT metrics_index/_doc/1
+PUT metrics_index
+{
+  "mappings": {
+    "properties": {
+      "network": {
+        "properties": {
+          "name": {
+            "type": "keyword"
+          }
+        }
+      },
+      "latency_histo": {
+         "type": "histogram"
+      }
+    }
+  }
+}
+
+PUT metrics_index/_doc/1?refresh
 {
 {
   "network.name" : "net-1",
   "network.name" : "net-1",
   "latency_histo" : {
   "latency_histo" : {
@@ -341,7 +359,7 @@ PUT metrics_index/_doc/1
    }
    }
 }
 }
 
 
-PUT metrics_index/_doc/2
+PUT metrics_index/_doc/2?refresh
 {
 {
   "network.name" : "net-2",
   "network.name" : "net-2",
   "latency_histo" : {
   "latency_histo" : {
@@ -372,7 +390,7 @@ return the following output:
 {
 {
   ...
   ...
   "aggregations": {
   "aggregations": {
-    "prices": {
+    "latency_buckets": {
       "buckets": [
       "buckets": [
         {
         {
           "key": 0.0,
           "key": 0.0,
@@ -395,7 +413,7 @@ return the following output:
   }
   }
 }
 }
 --------------------------------------------------
 --------------------------------------------------
-// TESTRESPONSE[skip:test not setup]
+// TESTRESPONSE[s/\.\.\./"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,/]
 
 
 [IMPORTANT]
 [IMPORTANT]
 ========
 ========