diff --git a/metricbeat/docker-compose.yml b/metricbeat/docker-compose.yml index ad1ecec93b47..b925b3446421 100644 --- a/metricbeat/docker-compose.yml +++ b/metricbeat/docker-compose.yml @@ -19,6 +19,7 @@ services: - ${PWD}/module/apache/_meta/env - ${PWD}/module/ceph/_meta/env - ${PWD}/module/couchbase/_meta/env + - ${PWD}/module/elasticsearch/_meta/env - ${PWD}/module/haproxy/_meta/env - ${PWD}/module/jolokia/_meta/env - ${PWD}/module/kafka/_meta/env @@ -38,22 +39,23 @@ services: proxy_dep: image: busybox depends_on: - apache: { condition: service_healthy } - ceph: { condition: service_healthy } - couchbase: { condition: service_healthy } - haproxy: { condition: service_healthy } - jolokia: { condition: service_healthy } - kafka: { condition: service_healthy } - kibana: { condition: service_healthy } - memcached: { condition: service_healthy } - mongodb: { condition: service_healthy } - mysql: { condition: service_healthy } - nginx: { condition: service_healthy } - phpfpm: { condition: service_healthy } - postgresql: { condition: service_healthy } - prometheus: { condition: service_healthy } - redis: { condition: service_healthy } - zookeeper: { condition: service_healthy } + apache: { condition: service_healthy } + ceph: { condition: service_healthy } + couchbase: { condition: service_healthy } + elasticsearch: { condition: service_healthy } + haproxy: { condition: service_healthy } + jolokia: { condition: service_healthy } + kafka: { condition: service_healthy } + kibana: { condition: service_healthy } + memcached: { condition: service_healthy } + mongodb: { condition: service_healthy } + mysql: { condition: service_healthy } + nginx: { condition: service_healthy } + phpfpm: { condition: service_healthy } + postgresql: { condition: service_healthy } + prometheus: { condition: service_healthy } + redis: { condition: service_healthy } + zookeeper: { condition: service_healthy } # Modules apache: @@ -65,6 +67,11 @@ services: couchbase: build: ${PWD}/module/couchbase/_meta + elasticsearch: + extends: + file: ${ES_BEATS}/testing/environments/${TESTING_ENVIRONMENT}.yml + service: elasticsearch + haproxy: build: ${PWD}/module/haproxy/_meta diff --git a/metricbeat/docs/fields.asciidoc b/metricbeat/docs/fields.asciidoc index a228a9d90986..4a52575a63a2 100644 --- a/metricbeat/docs/fields.asciidoc +++ b/metricbeat/docs/fields.asciidoc @@ -19,6 +19,7 @@ grouped in the following categories: * <> * <> * <> +* <> * <> * <> * <> @@ -1843,6 +1844,93 @@ type: long Total number of outgoing packets. +[[exported-fields-elasticsearch]] +== elasticsearch Fields + +[]experimental +elasticsearch Module + + + +[float] +== elasticsearch Fields + + + + +[float] +== stats Fields + +stats + + + +[float] +=== elasticsearch.stats.docs.count + +type: long + +Total number of existing documents. + + +[float] +=== elasticsearch.stats.docs.deleted + +type: long + +Total number of deleted documents. + + +[float] +=== elasticsearch.stats.segments.count + +type: long + +Total number of segments. + + +[float] +=== elasticsearch.stats.segments.memory.bytes + +type: long + +format: bytes + +Total size of segments in bytes. + + +[float] +=== elasticsearch.stats.shards.failed + +type: long + +Number of failed shards. + + +[float] +=== elasticsearch.stats.shards.successful + +type: long + +Number of successful shards. + + +[float] +=== elasticsearch.stats.shards.total + +type: long + +Total number of shards. + + +[float] +=== elasticsearch.stats.store.size.bytes + +type: long + +Total size of the store in bytes. + + [[exported-fields-golang]] == golang Fields diff --git a/metricbeat/docs/modules/elasticsearch.asciidoc b/metricbeat/docs/modules/elasticsearch.asciidoc new file mode 100644 index 000000000000..e9b47fb4c902 --- /dev/null +++ b/metricbeat/docs/modules/elasticsearch.asciidoc @@ -0,0 +1,37 @@ +//// +This file is generated! See scripts/docs_collector.py +//// + +[[metricbeat-module-elasticsearch]] +== elasticsearch Module + +This is the elasticsearch Module. The elasticsearch module contains a minimal set of metrics to enable monitoring of elasticsearch across multiple versions. + + + +[float] +=== Example Configuration + +The elasticsearch module supports the standard configuration options that are described +in <>. Here is an example configuration: + +[source,yaml] +---- +metricbeat.modules: +#- module: elasticsearch +# metricsets: ["stats"] +# enabled: true +# period: 10s +# hosts: ["localhost:9200"] + +---- + +[float] +=== Metricsets + +The following metricsets are available: + +* <> + +include::elasticsearch/stats.asciidoc[] + diff --git a/metricbeat/docs/modules/elasticsearch/stats.asciidoc b/metricbeat/docs/modules/elasticsearch/stats.asciidoc new file mode 100644 index 000000000000..64780fb46e09 --- /dev/null +++ b/metricbeat/docs/modules/elasticsearch/stats.asciidoc @@ -0,0 +1,19 @@ +//// +This file is generated! See scripts/docs_collector.py +//// + +[[metricbeat-metricset-elasticsearch-stats]] +include::../../../module/elasticsearch/stats/_meta/docs.asciidoc[] + + +==== Fields + +For a description of each field in the metricset, see the +<> section. + +Here is an example document generated by this metricset: + +[source,json] +---- +include::../../../module/elasticsearch/stats/_meta/data.json[] +---- diff --git a/metricbeat/docs/modules_list.asciidoc b/metricbeat/docs/modules_list.asciidoc index 43adfa393c03..07ab03812b04 100644 --- a/metricbeat/docs/modules_list.asciidoc +++ b/metricbeat/docs/modules_list.asciidoc @@ -6,6 +6,7 @@ This file is generated! See scripts/docs_collector.py * <> * <> * <> + * <> * <> * <> * <> @@ -31,6 +32,7 @@ include::modules/apache.asciidoc[] include::modules/ceph.asciidoc[] include::modules/couchbase.asciidoc[] include::modules/docker.asciidoc[] +include::modules/elasticsearch.asciidoc[] include::modules/golang.asciidoc[] include::modules/haproxy.asciidoc[] include::modules/jolokia.asciidoc[] diff --git a/metricbeat/include/list.go b/metricbeat/include/list.go index 28581540a112..be26b3f5adb2 100644 --- a/metricbeat/include/list.go +++ b/metricbeat/include/list.go @@ -28,6 +28,8 @@ import ( _ "github.com/elastic/beats/metricbeat/module/docker/info" _ "github.com/elastic/beats/metricbeat/module/docker/memory" _ "github.com/elastic/beats/metricbeat/module/docker/network" + _ "github.com/elastic/beats/metricbeat/module/elasticsearch" + _ "github.com/elastic/beats/metricbeat/module/elasticsearch/stats" _ "github.com/elastic/beats/metricbeat/module/golang" _ "github.com/elastic/beats/metricbeat/module/golang/expvar" _ "github.com/elastic/beats/metricbeat/module/golang/heap" diff --git a/metricbeat/metricbeat.full.yml b/metricbeat/metricbeat.full.yml index b809e7de2d42..d76364e58bc9 100644 --- a/metricbeat/metricbeat.full.yml +++ b/metricbeat/metricbeat.full.yml @@ -124,6 +124,14 @@ metricbeat.modules: #certificate: "/etc/pki/client/cert.pem" #key: "/etc/pki/client/cert.key" +#---------------------------- elasticsearch Module --------------------------- +#- module: elasticsearch +# metricsets: ["stats"] +# enabled: true +# period: 10s +# hosts: ["localhost:9200"] + + #------------------------------- golang Module ------------------------------- #- module: golang # metricsets: ["expvar","heap"] diff --git a/metricbeat/module/elasticsearch/_meta/config.yml b/metricbeat/module/elasticsearch/_meta/config.yml new file mode 100644 index 000000000000..c9a95ad017a8 --- /dev/null +++ b/metricbeat/module/elasticsearch/_meta/config.yml @@ -0,0 +1,6 @@ +#- module: elasticsearch +# metricsets: ["stats"] +# enabled: true +# period: 10s +# hosts: ["localhost:9200"] + diff --git a/metricbeat/module/elasticsearch/_meta/docs.asciidoc b/metricbeat/module/elasticsearch/_meta/docs.asciidoc new file mode 100644 index 000000000000..2afe260b3dec --- /dev/null +++ b/metricbeat/module/elasticsearch/_meta/docs.asciidoc @@ -0,0 +1,4 @@ +== elasticsearch Module + +This is the elasticsearch Module. The elasticsearch module contains a minimal set of metrics to enable monitoring of elasticsearch across multiple versions. + diff --git a/metricbeat/module/elasticsearch/_meta/env b/metricbeat/module/elasticsearch/_meta/env new file mode 100644 index 000000000000..04fe05053908 --- /dev/null +++ b/metricbeat/module/elasticsearch/_meta/env @@ -0,0 +1,2 @@ +ELASTICSEARCH_HOST=elasticsearch +ELASTICSEARCH_PORT=9200 diff --git a/metricbeat/module/elasticsearch/_meta/fields.yml b/metricbeat/module/elasticsearch/_meta/fields.yml new file mode 100644 index 000000000000..45b81dc80ff8 --- /dev/null +++ b/metricbeat/module/elasticsearch/_meta/fields.yml @@ -0,0 +1,12 @@ +- key: elasticsearch + title: "elasticsearch" + description: > + []experimental + + elasticsearch Module + short_config: false + fields: + - name: elasticsearch + type: group + description: > + fields: diff --git a/metricbeat/module/elasticsearch/doc.go b/metricbeat/module/elasticsearch/doc.go new file mode 100644 index 000000000000..3b4b7b2445a6 --- /dev/null +++ b/metricbeat/module/elasticsearch/doc.go @@ -0,0 +1,4 @@ +/* +Package elasticsearch is a Metricbeat module that contains MetricSets. +*/ +package elasticsearch diff --git a/metricbeat/module/elasticsearch/stats/_meta/data.json b/metricbeat/module/elasticsearch/stats/_meta/data.json new file mode 100644 index 000000000000..3709f62d0e3c --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/data.json @@ -0,0 +1,38 @@ +{ + "@timestamp": "2016-05-23T08:05:34.853Z", + "beat": { + "hostname": "host.example.com", + "name": "host.example.com" + }, + "elasticsearch": { + "stats": { + "docs": { + "count": 4, + "deleted": 0 + }, + "segments": { + "count": 4, + "memory": { + "bytes": 6647 + } + }, + "shards": { + "failed": 0, + "successful": 11, + "total": 22 + }, + "store": { + "size": { + "bytes": 16148 + } + } + } + }, + "metricset": { + "host": "127.0.0.1:9200", + "module": "elasticsearch", + "name": "stats", + "rtt": 115 + }, + "type": "metricsets" +} \ No newline at end of file diff --git a/metricbeat/module/elasticsearch/stats/_meta/docs.asciidoc b/metricbeat/module/elasticsearch/stats/_meta/docs.asciidoc new file mode 100644 index 000000000000..75a1b27bda49 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/docs.asciidoc @@ -0,0 +1,3 @@ +=== elasticsearch stats MetricSet + +This is the stats metricset of the module elasticsearch. This provides statistics across all indices. diff --git a/metricbeat/module/elasticsearch/stats/_meta/fields.yml b/metricbeat/module/elasticsearch/stats/_meta/fields.yml new file mode 100644 index 000000000000..675410c12e05 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/fields.yml @@ -0,0 +1,38 @@ +- name: stats + type: group + description: > + stats + fields: + - name: docs.count + type: long + description: > + Total number of existing documents. + - name: docs.deleted + type: long + description: > + Total number of deleted documents. + - name: segments.count + type: long + description: > + Total number of segments. + - name: segments.memory.bytes + type: long + format: bytes + description: > + Total size of segments in bytes. + - name: shards.failed + type: long + description: > + Number of failed shards. + - name: shards.successful + type: long + description: > + Number of successful shards. + - name: shards.total + type: long + description: > + Total number of shards. + - name: store.size.bytes + type: long + description: > + Total size of the store in bytes. diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/generate.sh b/metricbeat/module/elasticsearch/stats/_meta/test/generate.sh new file mode 100644 index 000000000000..7b93b2850fc8 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/generate.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# This script is to generate test input files for different elasticsearch versions +# +# The script creates an index, adds a document and writes the output from _stats +# to a document. The document name is based on the first param passed to the script. +# For es 5.1.2 pass 512 +# +# Note: Small corrections were made to the output documents as size of the index +# is not the same across all versions + +# Create index +curl -XPUT 'http://localhost:9200/testindex' + +# Add document +curl -XPUT 'http://localhost:9200/testindex/test/1?pretty' -H 'Content-Type: application/json' -d' +{ + "user" : "kimchy", + "message" : "trying out Elasticsearch" +} +' + +# Make sure index is created +# For 1x / 2x releases +curl -XPOST 'http://localhost:9200/_optimize' +# For 5x releases +curl -XPOST 'http://localhost:9200/_forcemerge' + +# Read stats output +curl -XGET 'http://localhost:9200/_stats?pretty' > stats.${1}.json diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/stats.175.json b/metricbeat/module/elasticsearch/stats/_meta/test/stats.175.json new file mode 100644 index 000000000000..d4fdb41902cc --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/stats.175.json @@ -0,0 +1,457 @@ +{ + "_shards" : { + "total" : 10, + "successful" : 5, + "failed" : 0 + }, + "_all" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 3249, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 189, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 26 + }, + "filter_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "id_cache" : { + "memory_size_in_bytes" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 17 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 3249, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 189, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 26 + }, + "filter_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "id_cache" : { + "memory_size_in_bytes" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 17 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + }, + "indices" : { + "testindex" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 189, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 26 + }, + "filter_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "id_cache" : { + "memory_size_in_bytes" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 17 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 189, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 26 + }, + "filter_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "id_cache" : { + "memory_size_in_bytes" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 17 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + } + } +} diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/stats.201.json b/metricbeat/module/elasticsearch/stats/_meta/test/stats.201.json new file mode 100644 index 000000000000..7c9f8e69f5c6 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/stats.201.json @@ -0,0 +1,509 @@ +{ + "_shards" : { + "total" : 10, + "successful" : 5, + "failed" : 0 + }, + "_all" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 254, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 51, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 16, + "total_time_in_millis" : 9 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 2320, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 40, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 254, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 51, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 16, + "total_time_in_millis" : 9 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 2320, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 40, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + }, + "indices" : { + "testindex" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 51, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 16, + "total_time_in_millis" : 9 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 2320, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 40, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 51, + "index_current" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 16, + "total_time_in_millis" : 9 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 2320, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 40, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 335544320, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + } + } +} diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/stats.240.json b/metricbeat/module/elasticsearch/stats/_meta/test/stats.240.json new file mode 100644 index 000000000000..aabdbe39558d --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/stats.240.json @@ -0,0 +1,513 @@ +{ + "_shards" : { + "total" : 10, + "successful" : 5, + "failed" : 0 + }, + "_all" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 71, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 15 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2106, + "terms_memory_in_bytes" : 1510, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 103887665, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 71, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 15 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2106, + "terms_memory_in_bytes" : 1510, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 103887665, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + }, + "indices" : { + "testindex" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 71, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 15 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1510, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 103887665, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 71, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 12, + "total_time_in_millis" : 15 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "percolate" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0, + "memory_size_in_bytes" : -1, + "memory_size" : "-1b", + "queries" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1510, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "index_writer_max_memory_in_bytes" : 103887665, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0 + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "suggest" : { + "total" : 0, + "time_in_millis" : 0, + "current" : 0 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + } + } +} diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.empty.json b/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.empty.json new file mode 100644 index 000000000000..7ff8d63cc2e8 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.empty.json @@ -0,0 +1,12 @@ +{ + "_shards" : { + "total" : 0, + "successful" : 0, + "failed" : 0 + }, + "_all" : { + "primaries" : { }, + "total" : { } + }, + "indices" : { } +} \ No newline at end of file diff --git a/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.json b/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.json new file mode 100644 index 000000000000..99650fea3258 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/_meta/test/stats.512.json @@ -0,0 +1,481 @@ +{ + "_shards" : { + "total" : 10, + "successful" : 5, + "failed" : 0 + }, + "_all" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 154, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0, + "suggest_total" : 0, + "suggest_time_in_millis" : 0, + "suggest_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 1, + "total_time_in_millis" : 168 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 6, + "total_time_in_millis" : 16 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1992, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "points_memory_in_bytes" : 0, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0, + "max_unsafe_auto_id_timestamp" : -1, + "file_sizes" : { } + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 154, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0, + "suggest_total" : 0, + "suggest_time_in_millis" : 0, + "suggest_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 1, + "total_time_in_millis" : 168 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 6, + "total_time_in_millis" : 16 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1992, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "points_memory_in_bytes" : 0, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0, + "max_unsafe_auto_id_timestamp" : -1, + "file_sizes" : { } + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + }, + "indices" : { + "testindex" : { + "primaries" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 154, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0, + "suggest_total" : 0, + "suggest_time_in_millis" : 0, + "suggest_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 1, + "total_time_in_millis" : 168 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 6, + "total_time_in_millis" : 16 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1992, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "points_memory_in_bytes" : 0, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0, + "max_unsafe_auto_id_timestamp" : -1, + "file_sizes" : { } + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + }, + "total" : { + "docs" : { + "count" : 1, + "deleted" : 0 + }, + "store" : { + "size_in_bytes" : 260, + "throttle_time_in_millis" : 0 + }, + "indexing" : { + "index_total" : 1, + "index_time_in_millis" : 154, + "index_current" : 0, + "index_failed" : 0, + "delete_total" : 0, + "delete_time_in_millis" : 0, + "delete_current" : 0, + "noop_update_total" : 0, + "is_throttled" : false, + "throttle_time_in_millis" : 0 + }, + "get" : { + "total" : 0, + "time_in_millis" : 0, + "exists_total" : 0, + "exists_time_in_millis" : 0, + "missing_total" : 0, + "missing_time_in_millis" : 0, + "current" : 0 + }, + "search" : { + "open_contexts" : 0, + "query_total" : 0, + "query_time_in_millis" : 0, + "query_current" : 0, + "fetch_total" : 0, + "fetch_time_in_millis" : 0, + "fetch_current" : 0, + "scroll_total" : 0, + "scroll_time_in_millis" : 0, + "scroll_current" : 0, + "suggest_total" : 0, + "suggest_time_in_millis" : 0, + "suggest_current" : 0 + }, + "merges" : { + "current" : 0, + "current_docs" : 0, + "current_size_in_bytes" : 0, + "total" : 0, + "total_time_in_millis" : 0, + "total_docs" : 0, + "total_size_in_bytes" : 0, + "total_stopped_time_in_millis" : 0, + "total_throttled_time_in_millis" : 0, + "total_auto_throttle_in_bytes" : 104857600 + }, + "refresh" : { + "total" : 1, + "total_time_in_millis" : 168 + }, + "flush" : { + "total" : 0, + "total_time_in_millis" : 0 + }, + "warmer" : { + "current" : 0, + "total" : 6, + "total_time_in_millis" : 16 + }, + "query_cache" : { + "memory_size_in_bytes" : 0, + "total_count" : 0, + "hit_count" : 0, + "miss_count" : 0, + "cache_size" : 0, + "cache_count" : 0, + "evictions" : 0 + }, + "fielddata" : { + "memory_size_in_bytes" : 0, + "evictions" : 0 + }, + "completion" : { + "size_in_bytes" : 0 + }, + "segments" : { + "count" : 1, + "memory_in_bytes" : 2588, + "terms_memory_in_bytes" : 1992, + "stored_fields_memory_in_bytes" : 312, + "term_vectors_memory_in_bytes" : 0, + "norms_memory_in_bytes" : 192, + "points_memory_in_bytes" : 0, + "doc_values_memory_in_bytes" : 92, + "index_writer_memory_in_bytes" : 0, + "version_map_memory_in_bytes" : 0, + "fixed_bit_set_memory_in_bytes" : 0, + "max_unsafe_auto_id_timestamp" : -1, + "file_sizes" : { } + }, + "translog" : { + "operations" : 0, + "size_in_bytes" : 215 + }, + "request_cache" : { + "memory_size_in_bytes" : 0, + "evictions" : 0, + "hit_count" : 0, + "miss_count" : 0 + }, + "recovery" : { + "current_as_source" : 0, + "current_as_target" : 0, + "throttle_time_in_millis" : 0 + } + } + } + } +} diff --git a/metricbeat/module/elasticsearch/stats/data.go b/metricbeat/module/elasticsearch/stats/data.go new file mode 100644 index 000000000000..e363cb5673bb --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/data.go @@ -0,0 +1,64 @@ +package stats + +import ( + "encoding/json" + + "github.com/elastic/beats/libbeat/common" + s "github.com/elastic/beats/metricbeat/schema" + c "github.com/elastic/beats/metricbeat/schema/mapstriface" +) + +var ( + shards = s.Schema{ + "shards": c.Dict("_shards", s.Schema{ + "total": c.Int("total"), + "successful": c.Int("successful"), + "failed": c.Int("failed"), + }), + } + + total = s.Schema{ + "docs": c.Dict("docs", s.Schema{ + "count": c.Int("count"), + "deleted": c.Int("deleted"), + }), + "store": c.Dict("store", s.Schema{ + "size": s.Object{ + "bytes": c.Int("size_in_bytes"), + }, + }), + "segments": c.Dict("segments", s.Schema{ + "count": c.Int("count"), + "memory": s.Object{ + "bytes": c.Int("memory_in_bytes"), + }, + }), + } +) + +func eventMapping(content []byte) (common.MapStr, error) { + + // Empty struct needed every time + var allStruct struct { + All struct { + Total map[string]interface{} `json:"total"` + } `json:"_all"` + } + var shardsStruct map[string]interface{} + + json.Unmarshal(content, &allStruct) + + // This happens before elasticsearch has any shards. Return empty document. + if len(allStruct.All.Total) == 0 { + return common.MapStr{}, nil + } + + json.Unmarshal(content, &shardsStruct) + + allData, errs1 := total.Apply(allStruct.All.Total) + shards, errs2 := shards.Apply(shardsStruct) + errs1.AddErrors(errs2) + + allData.Update(shards) + return allData, errs1 +} diff --git a/metricbeat/module/elasticsearch/stats/data_test.go b/metricbeat/module/elasticsearch/stats/data_test.go new file mode 100644 index 000000000000..85f333abdd5e --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/data_test.go @@ -0,0 +1,47 @@ +// +build !integration + +package stats + +import ( + "io/ioutil" + "path/filepath" + "testing" + + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/metricbeat/schema" + "github.com/stretchr/testify/assert" +) + +func TestStats(t *testing.T) { + + files, err := filepath.Glob("./_meta/test/stats.*.json") + assert.NoError(t, err) + + for _, f := range files { + content, err := ioutil.ReadFile(f) + assert.NoError(t, err) + + _, errs := eventMapping(content) + if errs == nil { + continue + } + errors, ok := errs.(*schema.Errors) + if ok { + assert.False(t, errors.HasRequiredErrors(), "mapping error: %s", errors) + } else { + t.Error(err) + } + } +} + +func TestEmptyStats(t *testing.T) { + + file := "./_meta/test/stats.512.empty.json" + + content, err := ioutil.ReadFile(file) + assert.NoError(t, err) + + event, errs := eventMapping(content) + assert.Equal(t, event, common.MapStr{}) + assert.Nil(t, errs) +} diff --git a/metricbeat/module/elasticsearch/stats/stats.go b/metricbeat/module/elasticsearch/stats/stats.go new file mode 100644 index 000000000000..0b73cdbea83d --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/stats.go @@ -0,0 +1,53 @@ +package stats + +import ( + "github.com/elastic/beats/libbeat/common" + "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/metricbeat/helper" + "github.com/elastic/beats/metricbeat/mb" + "github.com/elastic/beats/metricbeat/mb/parse" +) + +// init registers the MetricSet with the central registry. +// The New method will be called after the setup of the module and before starting to fetch data +func init() { + if err := mb.Registry.AddMetricSet("elasticsearch", "stats", New, hostParser); err != nil { + panic(err) + } +} + +var ( + hostParser = parse.URLHostParserBuilder{ + DefaultScheme: "http", + PathConfigKey: "path", + DefaultPath: "_stats", + }.Build() +) + +// MetricSet type defines all fields of the MetricSet +type MetricSet struct { + mb.BaseMetricSet + http *helper.HTTP +} + +// New create a new instance of the MetricSet +func New(base mb.BaseMetricSet) (mb.MetricSet, error) { + logp.Experimental("Elasticsearch stats metricset is enabled.") + return &MetricSet{ + base, + helper.NewHTTP(base), + }, nil +} + +// Fetch gathers stats for each overall _stats API (not specific to an index) +// More details can be found here: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html +func (m *MetricSet) Fetch() (common.MapStr, error) { + + content, err := m.http.FetchContent() + if err != nil { + return nil, err + } + + event, _ := eventMapping(content) + return event, nil +} diff --git a/metricbeat/module/elasticsearch/stats/stats_integration_test.go b/metricbeat/module/elasticsearch/stats/stats_integration_test.go new file mode 100644 index 000000000000..6eb520b915d0 --- /dev/null +++ b/metricbeat/module/elasticsearch/stats/stats_integration_test.go @@ -0,0 +1,57 @@ +// +build integration + +package stats + +import ( + "fmt" + "net/http" + "strings" + "testing" + + mbtest "github.com/elastic/beats/metricbeat/mb/testing" + "github.com/elastic/beats/metricbeat/module/elasticsearch" + "github.com/stretchr/testify/assert" +) + +func TestFetch(t *testing.T) { + err := loadData() + if err != nil { + t.Fatal("write", err) + } + + f := mbtest.NewEventFetcher(t, elasticsearch.GetConfig("stats")) + event, err := f.Fetch() + if !assert.NoError(t, err) { + t.FailNow() + } + + assert.NotNil(t, event) + t.Logf("%s/%s event: %+v", f.Module().Name(), f.Name(), event) +} + +func TestData(t *testing.T) { + err := loadData() + if err != nil { + t.Fatal("write", err) + } + + f := mbtest.NewEventFetcher(t, elasticsearch.GetConfig("stats")) + err = mbtest.WriteEvent(f, t) + if err != nil { + t.Fatal("write", err) + } +} + +func loadData() error { + client := &http.Client{} + url := fmt.Sprintf("http://%s:%s/tests/stats", elasticsearch.GetEnvHost(), elasticsearch.GetEnvPort()) + + request, err := http.NewRequest("POST", url, strings.NewReader(`{"hello":"world"}`)) + request.Header.Set("Content-Type", "application/json") + if err != nil { + return err + } + res, err := client.Do(request) + defer res.Body.Close() + return err +} diff --git a/metricbeat/module/elasticsearch/testing.go b/metricbeat/module/elasticsearch/testing.go new file mode 100644 index 000000000000..dc1ec72bad89 --- /dev/null +++ b/metricbeat/module/elasticsearch/testing.go @@ -0,0 +1,29 @@ +package elasticsearch + +import "os" + +func GetEnvHost() string { + host := os.Getenv("ELASTICSEARCH_HOST") + + if len(host) == 0 { + host = "127.0.0.1" + } + return host +} + +func GetEnvPort() string { + port := os.Getenv("ELASTICSEARCH_PORT") + + if len(port) == 0 { + port = "9200" + } + return port +} + +func GetConfig(metricset string) map[string]interface{} { + return map[string]interface{}{ + "module": "elasticsearch", + "metricsets": []string{metricset}, + "hosts": []string{GetEnvHost() + ":" + GetEnvPort()}, + } +} diff --git a/metricbeat/tests/system/test_elasticsearch.py b/metricbeat/tests/system/test_elasticsearch.py new file mode 100644 index 000000000000..c5742b8cc656 --- /dev/null +++ b/metricbeat/tests/system/test_elasticsearch.py @@ -0,0 +1,32 @@ +import os +import metricbeat +import unittest + + +class Test(metricbeat.BaseTest): + + @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test") + def test_stats(self): + """ + elasticsearch stats metricset test + """ + self.render_config_template(modules=[{ + "name": "elasticsearch", + "metricsets": ["stats"], + "hosts": self.get_hosts(), + "period": "1s", + }]) + proc = self.start_beat() + self.wait_until(lambda: self.output_lines() > 0, max_timeout=20) + proc.check_kill_and_wait() + + output = self.read_output_json() + self.assertTrue(len(output) >= 1) + evt = output[0] + print(evt) + + self.assert_fields_are_documented(evt) + + def get_hosts(self): + return [os.getenv('ELASTICSEARCH_HOST', 'localhost') + ':' + + os.getenv('ELASTICSEARCH_PORT', '9200')]