def test_query(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "skipped": 0,
                "successful": 1,
                "total": 1
            },
            "hits": {
                "hits": [],
                "max_score": None,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 3
        }

        expected = {'hits': 3, 'took_milliseconds': 3}
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #2
0
    def test_extended_stats(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'val_extended_stats': {
        #             'extended_stats': {'field': 'val'}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_extended_stats": {
                    "avg": 2.0,
                    "count": 3,
                    "max": 3.0,
                    "min": 1.0,
                    "std_deviation": 0.816496580927726,
                    "std_deviation_bounds": {
                        "lower": 0.36700683814454793,
                        "upper": 3.632993161855452
                    },
                    "sum": 6.0,
                    "sum_of_squares": 14.0,
                    "variance": 0.6666666666666666
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'val_extended_stats_avg': 2.0,
            'val_extended_stats_count': 3,
            'val_extended_stats_max': 3.0,
            'val_extended_stats_min': 1.0,
            'val_extended_stats_sum': 6.0,
            'val_extended_stats_std_deviation': 0.816496580927726,
            'val_extended_stats_std_deviation_bounds_lower':
            0.36700683814454793,
            'val_extended_stats_std_deviation_bounds_upper': 3.632993161855452,
            'val_extended_stats_sum_of_squares': 14.0,
            'val_extended_stats_variance': 0.6666666666666666
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
    def test_query_old(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {'hits': 3, 'took_milliseconds': 1}
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #4
0
    def test_query(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {'hits': 3}
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
Beispiel #5
0
    def test_endpoint(self):
        # Endpoint: /_alias?pretty
        response = {"foo": {"aliases": {"baz": {}}}}

        expected = {
            'alias{index="foo",alias="baz"}': 1,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_percentiles(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "val_percentiles": {
        #             "percentiles": {"field": "val"}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_percentiles": {
                    "values": {
                        "1.0": 1.02,
                        "25.0": 1.5,
                        "5.0": 1.1,
                        "50.0": 2.0,
                        "75.0": 2.5,
                        "95.0": 2.9,
                        "99.0": 2.98
                    }
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'val_percentiles_values_1_0': 1.02,
            'val_percentiles_values_5_0': 1.1,
            'val_percentiles_values_25_0': 1.5,
            'val_percentiles_values_50_0': 2.0,
            'val_percentiles_values_75_0': 2.5,
            'val_percentiles_values_95_0': 2.9,
            'val_percentiles_values_99_0': 2.98
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #7
0
    def test_percentiles(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'val_percentiles': {
        #             'percentiles': {'field': 'val'}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_percentiles": {
                    "values": {
                        "1.0": 1.02,
                        "25.0": 1.5,
                        "5.0": 1.1,
                        "50.0": 2.0,
                        "75.0": 2.5,
                        "95.0": 2.9,
                        "99.0": 2.98
                    }
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'val_percentiles_values_1_0': 1.02,
            'val_percentiles_values_5_0': 1.1,
            'val_percentiles_values_25_0': 1.5,
            'val_percentiles_values_50_0': 2.0,
            'val_percentiles_values_75_0': 2.5,
            'val_percentiles_values_95_0': 2.9,
            'val_percentiles_values_99_0': 2.98
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
    def test_filter(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "group1_filter": {
        #             "filter": {"term": {"group1": "a"}},
        #             "aggs": {
        #                 "val_sum": {
        #                     "sum": {"field": "val"}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "group1_filter": {
                    "doc_count": 2,
                    "val_sum": {
                        "value": 3.0
                    }
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'group1_filter_doc_count': 2,
            'group1_filter_val_sum_value': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_endpoint_no_properties(self):
        # Endpoint: /_mappings?pretty
        response = {
            "foo": {
                "mappings": {
                    "date_detection": False
                }
            }
        }

        expected = {}
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_stats(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "val_stats": {
        #             "stats": {"field": "val"}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_stats": {
                    "avg": 2.0,
                    "count": 3,
                    "max": 3.0,
                    "min": 1.0,
                    "sum": 6.0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'val_stats_avg': 2.0,
            'val_stats_count': 3,
            'val_stats_max': 3.0,
            'val_stats_min': 1.0,
            'val_stats_sum': 6.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_filter(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'group1_filter': {
        #             'filter': {'term': {'group1': 'a'}},
        #             'aggs': {
        #                 'val_sum': {
        #                     'sum': {'field': 'val'}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "group1_filter": {
                    "doc_count": 2,
                    "val_sum": {
                        "value": 3.0
                    }
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'group1_filter_doc_count': 2,
            'group1_filter_val_sum_value': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
    def test_stats(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'val_stats': {
        #             'stats': {'field': 'val'}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_stats": {
                    "avg": 2.0,
                    "count": 3,
                    "max": 3.0,
                    "min": 1.0,
                    "sum": 6.0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'val_stats_avg': 2.0,
            'val_stats_count': 3,
            'val_stats_max': 3.0,
            'val_stats_min': 1.0,
            'val_stats_sum': 6.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
    def test_old_endpoint_with_default(self):
        # Endpoint: /_mappings?pretty
        response = {
            "foo": {
                "mappings": {
                    "_default_": {
                        "properties": {
                            "val": {
                                "type": "long"
                            }
                        }
                    }
                }
            }
        }

        expected = {}
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_old_endpoint(self):
        # Endpoint: /_mappings?pretty
        response = {
            "foo": {
                "mappings": {
                    "bar": {
                        "properties": {
                            "group1": {
                                "type": "text",
                                "fields": {
                                    "keyword": {
                                        "type": "keyword",
                                        "ignore_above": 256
                                    }
                                }
                            },
                            "group2": {
                                "type": "text",
                                "fields": {
                                    "keyword": {
                                        "type": "keyword",
                                        "ignore_above": 256
                                    }
                                }
                            },
                            "val": {
                                "type": "long"
                            }
                        }
                    }
                }
            }
        }

        expected = {
            'field_count{index="foo",field_type="keyword"}': 2,
            'field_count{index="foo",field_type="long"}': 1,
            'field_count{index="foo",field_type="text"}': 2
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_avg(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "val_avg": {
        #             "avg": {"field": "val"}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_avg": {
                    "value": 2.0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            'val_avg_value': 2
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #16
0
    def test_avg(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'val_avg': {
        #             'avg': {'field': 'val'}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_avg": {
                    "value": 2.0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {'hits': 3, 'val_avg_value': 2}
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
Beispiel #17
0
    def test_endpoint(self):
        # Endpoint: /_cluster/health?pretty&level=shards
        response = {
            'cluster_name': 'elasticsearch',
            'status': 'yellow',
            'timed_out': False,
            'number_of_nodes': 1,
            'number_of_data_nodes': 1,
            'active_primary_shards': 5,
            'active_shards': 5,
            'relocating_shards': 0,
            'initializing_shards': 0,
            'unassigned_shards': 5,
            'delayed_unassigned_shards': 0,
            'number_of_pending_tasks': 0,
            'number_of_in_flight_fetch': 0,
            'task_max_waiting_in_queue_millis': 0,
            'active_shards_percent_as_number': 50.0,
            'indices': {
                'foo': {
                    'status': 'yellow',
                    'number_of_shards': 5,
                    'number_of_replicas': 1,
                    'active_primary_shards': 5,
                    'active_shards': 5,
                    'relocating_shards': 0,
                    'initializing_shards': 0,
                    'unassigned_shards': 5,
                    'shards': {
                        '0': {
                            'status': 'yellow',
                            'primary_active': True,
                            'active_shards': 1,
                            'relocating_shards': 0,
                            'initializing_shards': 0,
                            'unassigned_shards': 1
                        },
                        '1': {
                            'status': 'yellow',
                            'primary_active': True,
                            'active_shards': 1,
                            'relocating_shards': 0,
                            'initializing_shards': 0,
                            'unassigned_shards': 1
                        },
                        '2': {
                            'status': 'yellow',
                            'primary_active': True,
                            'active_shards': 1,
                            'relocating_shards': 0,
                            'initializing_shards': 0,
                            'unassigned_shards': 1
                        },
                        '3': {
                            'status': 'yellow',
                            'primary_active': True,
                            'active_shards': 1,
                            'relocating_shards': 0,
                            'initializing_shards': 0,
                            'unassigned_shards': 1
                        },
                        '4': {
                            'status': 'yellow',
                            'primary_active': True,
                            'active_shards': 1,
                            'relocating_shards': 0,
                            'initializing_shards': 0,
                            'unassigned_shards': 1
                        }
                    }
                }
            }
        }

        expected = {
            'status': 1,
            'status_green': 0,
            'status_yellow': 1,
            'status_red': 0,
            'number_of_nodes': 1,
            'number_of_data_nodes': 1,
            'active_primary_shards': 5,
            'active_shards': 5,
            'relocating_shards': 0,
            'initializing_shards': 0,
            'unassigned_shards': 5,
            'delayed_unassigned_shards': 0,
            'number_of_pending_tasks': 0,
            'number_of_in_flight_fetch': 0,
            'task_max_waiting_in_queue_millis': 0,
            'active_shards_percent_as_number': 50.0,
            'indices_status{index="foo"}': 1,
            'indices_status_green{index="foo"}': 0,
            'indices_status_yellow{index="foo"}': 1,
            'indices_status_red{index="foo"}': 0,
            'indices_number_of_shards{index="foo"}': 5,
            'indices_number_of_replicas{index="foo"}': 1,
            'indices_active_primary_shards{index="foo"}': 5,
            'indices_active_shards{index="foo"}': 5,
            'indices_relocating_shards{index="foo"}': 0,
            'indices_initializing_shards{index="foo"}': 0,
            'indices_unassigned_shards{index="foo"}': 5,
            'indices_shards_status{index="foo",shard="0"}': 1,
            'indices_shards_status_green{index="foo",shard="0"}': 0,
            'indices_shards_status_yellow{index="foo",shard="0"}': 1,
            'indices_shards_status_red{index="foo",shard="0"}': 0,
            'indices_shards_primary_active{index="foo",shard="0"}': 1,
            'indices_shards_active_shards{index="foo",shard="0"}': 1,
            'indices_shards_relocating_shards{index="foo",shard="0"}': 0,
            'indices_shards_initializing_shards{index="foo",shard="0"}': 0,
            'indices_shards_unassigned_shards{index="foo",shard="0"}': 1,
            'indices_shards_status{index="foo",shard="1"}': 1,
            'indices_shards_status_green{index="foo",shard="1"}': 0,
            'indices_shards_status_yellow{index="foo",shard="1"}': 1,
            'indices_shards_status_red{index="foo",shard="1"}': 0,
            'indices_shards_primary_active{index="foo",shard="1"}': 1,
            'indices_shards_active_shards{index="foo",shard="1"}': 1,
            'indices_shards_relocating_shards{index="foo",shard="1"}': 0,
            'indices_shards_initializing_shards{index="foo",shard="1"}': 0,
            'indices_shards_unassigned_shards{index="foo",shard="1"}': 1,
            'indices_shards_status{index="foo",shard="2"}': 1,
            'indices_shards_status_green{index="foo",shard="2"}': 0,
            'indices_shards_status_yellow{index="foo",shard="2"}': 1,
            'indices_shards_status_red{index="foo",shard="2"}': 0,
            'indices_shards_primary_active{index="foo",shard="2"}': 1,
            'indices_shards_active_shards{index="foo",shard="2"}': 1,
            'indices_shards_relocating_shards{index="foo",shard="2"}': 0,
            'indices_shards_initializing_shards{index="foo",shard="2"}': 0,
            'indices_shards_unassigned_shards{index="foo",shard="2"}': 1,
            'indices_shards_status{index="foo",shard="3"}': 1,
            'indices_shards_status_green{index="foo",shard="3"}': 0,
            'indices_shards_status_yellow{index="foo",shard="3"}': 1,
            'indices_shards_status_red{index="foo",shard="3"}': 0,
            'indices_shards_primary_active{index="foo",shard="3"}': 1,
            'indices_shards_active_shards{index="foo",shard="3"}': 1,
            'indices_shards_relocating_shards{index="foo",shard="3"}': 0,
            'indices_shards_initializing_shards{index="foo",shard="3"}': 0,
            'indices_shards_unassigned_shards{index="foo",shard="3"}': 1,
            'indices_shards_status{index="foo",shard="4"}': 1,
            'indices_shards_status_green{index="foo",shard="4"}': 0,
            'indices_shards_status_yellow{index="foo",shard="4"}': 1,
            'indices_shards_status_red{index="foo",shard="4"}': 0,
            'indices_shards_primary_active{index="foo",shard="4"}': 1,
            'indices_shards_active_shards{index="foo",shard="4"}': 1,
            'indices_shards_relocating_shards{index="foo",shard="4"}': 0,
            'indices_shards_initializing_shards{index="foo",shard="4"}': 0,
            'indices_shards_unassigned_shards{index="foo",shard="4"}': 1,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #18
0
    def test_endpoint_indices(self):

        expected = {
            'primaries_docs_count{index="foo"}':
            3,
            'primaries_docs_deleted{index="foo"}':
            0,
            'primaries_store_size_in_bytes{index="foo"}':
            12690,
            'primaries_store_throttle_time_in_millis{index="foo"}':
            0,
            'primaries_indexing_index_total{index="foo"}':
            3,
            'primaries_indexing_index_time_in_millis{index="foo"}':
            45,
            'primaries_indexing_index_current{index="foo"}':
            0,
            'primaries_indexing_index_failed{index="foo"}':
            0,
            'primaries_indexing_delete_total{index="foo"}':
            0,
            'primaries_indexing_delete_time_in_millis{index="foo"}':
            0,
            'primaries_indexing_delete_current{index="foo"}':
            0,
            'primaries_indexing_noop_update_total{index="foo"}':
            0,
            'primaries_indexing_is_throttled{index="foo"}':
            0,
            'primaries_indexing_throttle_time_in_millis{index="foo"}':
            0,
            'primaries_get_total{index="foo"}':
            0,
            'primaries_get_time_in_millis{index="foo"}':
            0,
            'primaries_get_exists_total{index="foo"}':
            0,
            'primaries_get_exists_time_in_millis{index="foo"}':
            0,
            'primaries_get_missing_total{index="foo"}':
            0,
            'primaries_get_missing_time_in_millis{index="foo"}':
            0,
            'primaries_get_current{index="foo"}':
            0,
            'primaries_search_open_contexts{index="foo"}':
            0,
            'primaries_search_query_total{index="foo"}':
            0,
            'primaries_search_query_time_in_millis{index="foo"}':
            0,
            'primaries_search_query_current{index="foo"}':
            0,
            'primaries_search_fetch_total{index="foo"}':
            0,
            'primaries_search_fetch_time_in_millis{index="foo"}':
            0,
            'primaries_search_fetch_current{index="foo"}':
            0,
            'primaries_search_scroll_total{index="foo"}':
            0,
            'primaries_search_scroll_time_in_millis{index="foo"}':
            0,
            'primaries_search_scroll_current{index="foo"}':
            0,
            'primaries_search_suggest_total{index="foo"}':
            0,
            'primaries_search_suggest_time_in_millis{index="foo"}':
            0,
            'primaries_search_suggest_current{index="foo"}':
            0,
            'primaries_merges_current{index="foo"}':
            0,
            'primaries_merges_current_docs{index="foo"}':
            0,
            'primaries_merges_current_size_in_bytes{index="foo"}':
            0,
            'primaries_merges_total{index="foo"}':
            0,
            'primaries_merges_total_time_in_millis{index="foo"}':
            0,
            'primaries_merges_total_docs{index="foo"}':
            0,
            'primaries_merges_total_size_in_bytes{index="foo"}':
            0,
            'primaries_merges_total_stopped_time_in_millis{index="foo"}':
            0,
            'primaries_merges_total_throttled_time_in_millis{index="foo"}':
            0,
            'primaries_merges_total_auto_throttle_in_bytes{index="foo"}':
            104857600,
            'primaries_refresh_total{index="foo"}':
            3,
            'primaries_refresh_total_time_in_millis{index="foo"}':
            107,
            'primaries_flush_total{index="foo"}':
            0,
            'primaries_flush_total_time_in_millis{index="foo"}':
            0,
            'primaries_warmer_current{index="foo"}':
            0,
            'primaries_warmer_total{index="foo"}':
            8,
            'primaries_warmer_total_time_in_millis{index="foo"}':
            6,
            'primaries_query_cache_memory_size_in_bytes{index="foo"}':
            0,
            'primaries_query_cache_total_count{index="foo"}':
            0,
            'primaries_query_cache_hit_count{index="foo"}':
            0,
            'primaries_query_cache_miss_count{index="foo"}':
            0,
            'primaries_query_cache_cache_size{index="foo"}':
            0,
            'primaries_query_cache_cache_count{index="foo"}':
            0,
            'primaries_query_cache_evictions{index="foo"}':
            0,
            'primaries_fielddata_memory_size_in_bytes{index="foo"}':
            0,
            'primaries_fielddata_evictions{index="foo"}':
            0,
            'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}':
            1024,
            'primaries_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}':
            2048,
            'primaries_completion_size_in_bytes{index="foo"}':
            0,
            'primaries_segments_count{index="foo"}':
            3,
            'primaries_segments_memory_in_bytes{index="foo"}':
            7908,
            'primaries_segments_terms_memory_in_bytes{index="foo"}':
            5976,
            'primaries_segments_stored_fields_memory_in_bytes{index="foo"}':
            936,
            'primaries_segments_term_vectors_memory_in_bytes{index="foo"}':
            0,
            'primaries_segments_norms_memory_in_bytes{index="foo"}':
            576,
            'primaries_segments_points_memory_in_bytes{index="foo"}':
            144,
            'primaries_segments_doc_values_memory_in_bytes{index="foo"}':
            276,
            'primaries_segments_index_writer_memory_in_bytes{index="foo"}':
            0,
            'primaries_segments_version_map_memory_in_bytes{index="foo"}':
            0,
            'primaries_segments_fixed_bit_set_memory_in_bytes{index="foo"}':
            0,
            'primaries_segments_max_unsafe_auto_id_timestamp{index="foo"}':
            -1,
            'primaries_translog_operations{index="foo"}':
            3,
            'primaries_translog_size_in_bytes{index="foo"}':
            491,
            'primaries_request_cache_memory_size_in_bytes{index="foo"}':
            0,
            'primaries_request_cache_evictions{index="foo"}':
            0,
            'primaries_request_cache_hit_count{index="foo"}':
            0,
            'primaries_request_cache_miss_count{index="foo"}':
            0,
            'primaries_recovery_current_as_source{index="foo"}':
            0,
            'primaries_recovery_current_as_target{index="foo"}':
            0,
            'primaries_recovery_throttle_time_in_millis{index="foo"}':
            0,
            'total_docs_count{index="foo"}':
            3,
            'total_docs_deleted{index="foo"}':
            0,
            'total_store_size_in_bytes{index="foo"}':
            12690,
            'total_store_throttle_time_in_millis{index="foo"}':
            0,
            'total_indexing_index_total{index="foo"}':
            3,
            'total_indexing_index_time_in_millis{index="foo"}':
            45,
            'total_indexing_index_current{index="foo"}':
            0,
            'total_indexing_index_failed{index="foo"}':
            0,
            'total_indexing_delete_total{index="foo"}':
            0,
            'total_indexing_delete_time_in_millis{index="foo"}':
            0,
            'total_indexing_delete_current{index="foo"}':
            0,
            'total_indexing_noop_update_total{index="foo"}':
            0,
            'total_indexing_is_throttled{index="foo"}':
            0,
            'total_indexing_throttle_time_in_millis{index="foo"}':
            0,
            'total_get_total{index="foo"}':
            0,
            'total_get_time_in_millis{index="foo"}':
            0,
            'total_get_exists_total{index="foo"}':
            0,
            'total_get_exists_time_in_millis{index="foo"}':
            0,
            'total_get_missing_total{index="foo"}':
            0,
            'total_get_missing_time_in_millis{index="foo"}':
            0,
            'total_get_current{index="foo"}':
            0,
            'total_search_open_contexts{index="foo"}':
            0,
            'total_search_query_total{index="foo"}':
            0,
            'total_search_query_time_in_millis{index="foo"}':
            0,
            'total_search_query_current{index="foo"}':
            0,
            'total_search_fetch_total{index="foo"}':
            0,
            'total_search_fetch_time_in_millis{index="foo"}':
            0,
            'total_search_fetch_current{index="foo"}':
            0,
            'total_search_scroll_total{index="foo"}':
            0,
            'total_search_scroll_time_in_millis{index="foo"}':
            0,
            'total_search_scroll_current{index="foo"}':
            0,
            'total_search_suggest_total{index="foo"}':
            0,
            'total_search_suggest_time_in_millis{index="foo"}':
            0,
            'total_search_suggest_current{index="foo"}':
            0,
            'total_merges_current{index="foo"}':
            0,
            'total_merges_current_docs{index="foo"}':
            0,
            'total_merges_current_size_in_bytes{index="foo"}':
            0,
            'total_merges_total{index="foo"}':
            0,
            'total_merges_total_time_in_millis{index="foo"}':
            0,
            'total_merges_total_docs{index="foo"}':
            0,
            'total_merges_total_size_in_bytes{index="foo"}':
            0,
            'total_merges_total_stopped_time_in_millis{index="foo"}':
            0,
            'total_merges_total_throttled_time_in_millis{index="foo"}':
            0,
            'total_merges_total_auto_throttle_in_bytes{index="foo"}':
            104857600,
            'total_refresh_total{index="foo"}':
            3,
            'total_refresh_total_time_in_millis{index="foo"}':
            107,
            'total_flush_total{index="foo"}':
            0,
            'total_flush_total_time_in_millis{index="foo"}':
            0,
            'total_warmer_current{index="foo"}':
            0,
            'total_warmer_total{index="foo"}':
            8,
            'total_warmer_total_time_in_millis{index="foo"}':
            6,
            'total_query_cache_memory_size_in_bytes{index="foo"}':
            0,
            'total_query_cache_total_count{index="foo"}':
            0,
            'total_query_cache_hit_count{index="foo"}':
            0,
            'total_query_cache_miss_count{index="foo"}':
            0,
            'total_query_cache_cache_size{index="foo"}':
            0,
            'total_query_cache_cache_count{index="foo"}':
            0,
            'total_query_cache_evictions{index="foo"}':
            0,
            'total_fielddata_memory_size_in_bytes{index="foo"}':
            0,
            'total_fielddata_evictions{index="foo"}':
            0,
            'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group1"}':
            1024,
            'total_fielddata_fields_memory_size_in_bytes{index="foo",field="group2"}':
            2048,
            'total_completion_size_in_bytes{index="foo"}':
            0,
            'total_segments_count{index="foo"}':
            3,
            'total_segments_memory_in_bytes{index="foo"}':
            7908,
            'total_segments_terms_memory_in_bytes{index="foo"}':
            5976,
            'total_segments_stored_fields_memory_in_bytes{index="foo"}':
            936,
            'total_segments_term_vectors_memory_in_bytes{index="foo"}':
            0,
            'total_segments_norms_memory_in_bytes{index="foo"}':
            576,
            'total_segments_points_memory_in_bytes{index="foo"}':
            144,
            'total_segments_doc_values_memory_in_bytes{index="foo"}':
            276,
            'total_segments_index_writer_memory_in_bytes{index="foo"}':
            0,
            'total_segments_version_map_memory_in_bytes{index="foo"}':
            0,
            'total_segments_fixed_bit_set_memory_in_bytes{index="foo"}':
            0,
            'total_segments_max_unsafe_auto_id_timestamp{index="foo"}':
            -1,
            'total_translog_operations{index="foo"}':
            3,
            'total_translog_size_in_bytes{index="foo"}':
            491,
            'total_request_cache_memory_size_in_bytes{index="foo"}':
            0,
            'total_request_cache_evictions{index="foo"}':
            0,
            'total_request_cache_hit_count{index="foo"}':
            0,
            'total_request_cache_miss_count{index="foo"}':
            0,
            'total_recovery_current_as_source{index="foo"}':
            0,
            'total_recovery_current_as_target{index="foo"}':
            0,
            'total_recovery_throttle_time_in_millis{index="foo"}':
            0,
        }
        result = convert_result(
            parse_response(self.response, parse_indices=True))
        self.assertEqual(expected, result)
    def test_endpoint(self):
        # Endpoint: /_nodes/stats?pretty
        response = {
            '_nodes': {
                'total': 1,
                'successful': 1,
                'failed': 0
            },
            'cluster_name': 'elasticsearch',
            'nodes': {
                'bRcKq5zUTAuwNf4qvnXzIQ': {
                    'timestamp': 1484861642281,
                    'name': 'bRcKq5z',
                    'transport_address': '127.0.0.1:9300',
                    'host': '127.0.0.1',
                    'ip': '127.0.0.1:9300',
                    'roles': [
                        'master',
                        'data',
                        'ingest'
                    ],
                    'indices': {
                        'docs': {
                            'count': 3,
                            'deleted': 0
                        },
                        'store': {
                            'size_in_bytes': 12972,
                            'throttle_time_in_millis': 0
                        },
                        'indexing': {
                            'index_total': 3,
                            'index_time_in_millis': 95,
                            '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': 6,
                            'total_time_in_millis': 304
                        },
                        'flush': {
                            'total': 3,
                            'total_time_in_millis': 72
                        },
                        'warmer': {
                            'current': 0,
                            'total': 14,
                            'total_time_in_millis': 19
                        },
                        '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': 3,
                            'memory_in_bytes': 7908,
                            'terms_memory_in_bytes': 5976,
                            'stored_fields_memory_in_bytes': 936,
                            'term_vectors_memory_in_bytes': 0,
                            'norms_memory_in_bytes': 576,
                            'points_memory_in_bytes': 144,
                            'doc_values_memory_in_bytes': 276,
                            '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
                        }
                    },
                    'os': {
                        'timestamp': 1484861642359,
                        'cpu': {
                            'percent': 53,
                            'load_average': {
                                '1m': 2.53,
                                '5m': 2.3,
                                '15m': 2.23
                            }
                        },
                        'mem': {
                            'total_in_bytes': 16703762432,
                            'free_in_bytes': 164323328,
                            'used_in_bytes': 16539439104,
                            'free_percent': 1,
                            'used_percent': 99
                        },
                        'swap': {
                            'total_in_bytes': 17054035968,
                            'free_in_bytes': 12281872384,
                            'used_in_bytes': 4772163584
                        }
                    },
                    'process': {
                        'timestamp': 1484861642360,
                        'open_file_descriptors': 180,
                        'max_file_descriptors': 1048576,
                        'cpu': {
                            'percent': 0,
                            'total_in_millis': 28270
                        },
                        'mem': {
                            'total_virtual_in_bytes': 5947977728
                        }
                    },
                    'jvm': {
                        'timestamp': 1484861642361,
                        'uptime_in_millis': 614767,
                        'mem': {
                            'heap_used_in_bytes': 233688144,
                            'heap_used_percent': 11,
                            'heap_committed_in_bytes': 2112618496,
                            'heap_max_in_bytes': 2112618496,
                            'non_heap_used_in_bytes': 67167936,
                            'non_heap_committed_in_bytes': 71741440,
                            'pools': {
                                'young': {
                                    'used_in_bytes': 189809608,
                                    'max_in_bytes': 279183360,
                                    'peak_used_in_bytes': 279183360,
                                    'peak_max_in_bytes': 279183360
                                },
                                'survivor': {
                                    'used_in_bytes': 34865136,
                                    'max_in_bytes': 34865152,
                                    'peak_used_in_bytes': 34865136,
                                    'peak_max_in_bytes': 34865152
                                },
                                'old': {
                                    'used_in_bytes': 9013400,
                                    'max_in_bytes': 1798569984,
                                    'peak_used_in_bytes': 9013400,
                                    'peak_max_in_bytes': 1798569984
                                }
                            }
                        },
                        'threads': {
                            'count': 40,
                            'peak_count': 46
                        },
                        'gc': {
                            'collectors': {
                                'young': {
                                    'collection_count': 2,
                                    'collection_time_in_millis': 189
                                },
                                'old': {
                                    'collection_count': 1,
                                    'collection_time_in_millis': 143
                                }
                            }
                        },
                        'buffer_pools': {
                            'direct': {
                                'count': 29,
                                'used_in_bytes': 87069546,
                                'total_capacity_in_bytes': 87069545
                            },
                            'mapped': {
                                'count': 3,
                                'used_in_bytes': 9658,
                                'total_capacity_in_bytes': 9658
                            }
                        },
                        'classes': {
                            'current_loaded_count': 10236,
                            'total_loaded_count': 10236,
                            'total_unloaded_count': 0
                        }
                    },
                    'thread_pool': {
                        'bulk': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'fetch_shard_started': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'fetch_shard_store': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'flush': {
                            'threads': 2,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 2,
                            'completed': 6
                        },
                        'force_merge': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'generic': {
                            'threads': 4,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 4,
                            'completed': 73
                        },
                        'get': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'index': {
                            'threads': 3,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 3,
                            'completed': 3
                        },
                        'listener': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'management': {
                            'threads': 3,
                            'queue': 0,
                            'active': 1,
                            'rejected': 0,
                            'largest': 3,
                            'completed': 77
                        },
                        'refresh': {
                            'threads': 1,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 1,
                            'completed': 588
                        },
                        'search': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'snapshot': {
                            'threads': 0,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 0,
                            'completed': 0
                        },
                        'warmer': {
                            'threads': 1,
                            'queue': 0,
                            'active': 0,
                            'rejected': 0,
                            'largest': 1,
                            'completed': 9
                        }
                    },
                    'fs': {
                        'timestamp': 1484861642369,
                        'total': {
                            'total_in_bytes': 233134567424,
                            'free_in_bytes': 92206276608,
                            'available_in_bytes': 80292356096,
                            'spins': 'true'
                        },
                        'data': [
                            {
                                'path': '/usr/share/elasticsearch/data/nodes/0',
                                'mount': '/usr/share/elasticsearch/data (/dev/mapper/ubuntu--vg-root)',
                                'type': 'ext4',
                                'total_in_bytes': 233134567424,
                                'free_in_bytes': 92206276608,
                                'available_in_bytes': 80292356096,
                                'spins': 'true'
                            }
                        ],
                        'io_stats': {
                            'devices': [
                                {
                                    'device_name': 'dm-0',
                                    'operations': 22045,
                                    'read_operations': 14349,
                                    'write_operations': 7696,
                                    'read_kilobytes': 294732,
                                    'write_kilobytes': 113424
                                }
                            ],
                            'total': {
                                'operations': 22045,
                                'read_operations': 14349,
                                'write_operations': 7696,
                                'read_kilobytes': 294732,
                                'write_kilobytes': 113424
                            }
                        }
                    },
                    'transport': {
                        'server_open': 0,
                        'rx_count': 8,
                        'rx_size_in_bytes': 3607,
                        'tx_count': 8,
                        'tx_size_in_bytes': 3607
                    },
                    'http': {
                        'current_open': 1,
                        'total_opened': 4
                    },
                    'breakers': {
                        'request': {
                            'limit_size_in_bytes': 1267571097,
                            'limit_size': '1.1gb',
                            'estimated_size_in_bytes': 0,
                            'estimated_size': '0b',
                            'overhead': 1.0,
                            'tripped': 0
                        },
                        'fielddata': {
                            'limit_size_in_bytes': 1267571097,
                            'limit_size': '1.1gb',
                            'estimated_size_in_bytes': 0,
                            'estimated_size': '0b',
                            'overhead': 1.03,
                            'tripped': 0
                        },
                        'in_flight_requests': {
                            'limit_size_in_bytes': 2112618496,
                            'limit_size': '1.9gb',
                            'estimated_size_in_bytes': 0,
                            'estimated_size': '0b',
                            'overhead': 1.0,
                            'tripped': 0
                        },
                        'parent': {
                            'limit_size_in_bytes': 1478832947,
                            'limit_size': '1.3gb',
                            'estimated_size_in_bytes': 0,
                            'estimated_size': '0b',
                            'overhead': 1.0,
                            'tripped': 0
                        }
                    },
                    'script': {
                        'compilations': 0,
                        'cache_evictions': 0
                    },
                    'discovery': {
                        'cluster_state_queue': {
                            'total': 0,
                            'pending': 0,
                            'committed': 0
                        }
                    },
                    'ingest': {
                        'total': {
                            'count': 0,
                            'time_in_millis': 0,
                            'current': 0,
                            'failed': 0
                        },
                        'pipelines': {}
                    }
                }
            }
        }

        expected = {
            'indices_docs_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3,
            'indices_docs_deleted{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_store_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 12972,
            'indices_store_throttle_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_index_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3,
            'indices_indexing_index_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 95,
            'indices_indexing_index_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_index_failed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_delete_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_delete_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_delete_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_noop_update_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_is_throttled{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_indexing_throttle_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_exists_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_exists_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_missing_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_missing_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_get_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_open_contexts{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_query_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_query_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_query_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_fetch_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_fetch_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_fetch_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_scroll_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_scroll_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_scroll_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_suggest_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_suggest_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_search_suggest_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_current_docs{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_current_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_docs{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_stopped_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_throttled_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_merges_total_auto_throttle_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 104857600,
            'indices_refresh_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 6,
            'indices_refresh_total_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 304,
            'indices_flush_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3,
            'indices_flush_total_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 72,
            'indices_warmer_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 14,
            'indices_warmer_total_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 19,
            'indices_warmer_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_memory_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_total_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_hit_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_miss_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_cache_size{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_cache_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_query_cache_evictions{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_fielddata_memory_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_fielddata_evictions{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_completion_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_segments_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3,
            'indices_segments_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 7908,
            'indices_segments_terms_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 5976,
            'indices_segments_stored_fields_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 936,
            'indices_segments_term_vectors_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_segments_norms_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 576,
            'indices_segments_points_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 144,
            'indices_segments_doc_values_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 276,
            'indices_segments_index_writer_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_segments_version_map_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_segments_fixed_bit_set_memory_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_segments_max_unsafe_auto_id_timestamp{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': -1,
            'indices_translog_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_translog_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 215,
            'indices_request_cache_memory_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_request_cache_evictions{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_request_cache_hit_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_request_cache_miss_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_recovery_current_as_source{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_recovery_current_as_target{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'indices_recovery_throttle_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'os_cpu_percent{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 53,
            'os_cpu_load_average_1m{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2.53,
            'os_cpu_load_average_5m{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2.3,
            'os_cpu_load_average_15m{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2.23,
            'os_mem_total_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 16703762432,
            'os_mem_free_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 164323328,
            'os_mem_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 16539439104,
            'os_mem_free_percent{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1,
            'os_mem_used_percent{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 99,
            'os_swap_free_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 12281872384,
            'os_swap_total_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 17054035968,
            'os_swap_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 4772163584,
            'process_open_file_descriptors{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 180,
            'process_max_file_descriptors{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1048576,
            'process_cpu_percent{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'process_cpu_total_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 28270,
            'process_mem_total_virtual_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 5947977728,
            'jvm_uptime_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 614767,
            'jvm_mem_heap_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 233688144,
            'jvm_mem_heap_used_percent{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 11,
            'jvm_mem_heap_committed_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2112618496,
            'jvm_mem_heap_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2112618496,
            'jvm_mem_non_heap_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 67167936,
            'jvm_mem_non_heap_committed_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 71741440,
            'jvm_mem_pools_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="young"}': 189809608,
            'jvm_mem_pools_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="young"}': 279183360,
            'jvm_mem_pools_peak_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="young"}': 279183360,
            'jvm_mem_pools_peak_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="young"}': 279183360,
            'jvm_mem_pools_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="survivor"}': 34865136,
            'jvm_mem_pools_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="survivor"}': 34865152,
            'jvm_mem_pools_peak_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="survivor"}': 34865136,
            'jvm_mem_pools_peak_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="survivor"}': 34865152,
            'jvm_mem_pools_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="old"}': 9013400,
            'jvm_mem_pools_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="old"}': 1798569984,
            'jvm_mem_pools_peak_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="old"}': 9013400,
            'jvm_mem_pools_peak_max_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",pool="old"}': 1798569984,
            'jvm_threads_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 40,
            'jvm_threads_peak_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 46,
            'jvm_gc_collectors_collection_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",collector="young"}': 2,
            'jvm_gc_collectors_collection_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",collector="young"}': 189,
            'jvm_gc_collectors_collection_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",collector="old"}': 1,
            'jvm_gc_collectors_collection_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",collector="old"}': 143,
            'jvm_buffer_pools_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="direct"}': 29,
            'jvm_buffer_pools_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="direct"}': 87069546,
            'jvm_buffer_pools_total_capacity_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="direct"}': 87069545,
            'jvm_buffer_pools_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="mapped"}': 3,
            'jvm_buffer_pools_used_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="mapped"}': 9658,
            'jvm_buffer_pools_total_capacity_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",buffer_pool="mapped"}': 9658,
            'jvm_classes_current_loaded_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 10236,
            'jvm_classes_total_loaded_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 10236,
            'jvm_classes_total_unloaded_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="bulk"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_started"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="fetch_shard_store"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 2,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 2,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="flush"}': 6,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="force_merge"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 4,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 4,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="generic"}': 73,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="get"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 3,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 3,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="index"}': 3,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="listener"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 3,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 1,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 3,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="management"}': 77,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 1,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 1,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="refresh"}': 588,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="search"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="snapshot"}': 0,
            'thread_pool_threads{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 1,
            'thread_pool_rejected{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 0,
            'thread_pool_active{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 0,
            'thread_pool_queue{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 0,
            'thread_pool_largest{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 1,
            'thread_pool_completed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",thread_pool="warmer"}': 9,
            'fs_total_total_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 233134567424,
            'fs_total_free_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 92206276608,
            'fs_total_available_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 80292356096,
            'fs_data_total_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",path="/usr/share/elasticsearch/data/nodes/0"}': 233134567424,
            'fs_data_free_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",path="/usr/share/elasticsearch/data/nodes/0"}': 92206276608,
            'fs_data_available_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",path="/usr/share/elasticsearch/data/nodes/0"}': 80292356096,
            'fs_io_stats_devices_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",device_name="dm-0"}': 22045,
            'fs_io_stats_devices_read_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",device_name="dm-0"}': 14349,
            'fs_io_stats_devices_write_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",device_name="dm-0"}': 7696,
            'fs_io_stats_devices_read_kilobytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",device_name="dm-0"}': 294732,
            'fs_io_stats_devices_write_kilobytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z",device_name="dm-0"}': 113424,
            'fs_io_stats_total_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 22045,
            'fs_io_stats_total_read_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 14349,
            'fs_io_stats_total_write_operations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 7696,
            'fs_io_stats_total_read_kilobytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 294732,
            'fs_io_stats_total_write_kilobytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 113424,
            'transport_server_open{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'transport_rx_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 8,
            'transport_rx_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3607,
            'transport_tx_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 8,
            'transport_tx_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 3607,
            'http_current_open{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1,
            'http_total_opened{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 4,
            'breakers_request_limit_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1267571097,
            'breakers_request_estimated_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_request_overhead{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1.0,
            'breakers_request_tripped{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_fielddata_limit_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1267571097,
            'breakers_fielddata_estimated_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_fielddata_overhead{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1.03,
            'breakers_fielddata_tripped{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_in_flight_requests_limit_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 2112618496,
            'breakers_in_flight_requests_estimated_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_in_flight_requests_overhead{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1.0,
            'breakers_in_flight_requests_tripped{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_parent_limit_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1478832947,
            'breakers_parent_estimated_size_in_bytes{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'breakers_parent_overhead{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 1.0,
            'breakers_parent_tripped{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'script_compilations{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'script_cache_evictions{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'discovery_cluster_state_queue_total{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'discovery_cluster_state_queue_pending{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'discovery_cluster_state_queue_committed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'ingest_total_count{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'ingest_total_time_in_millis{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'ingest_total_current{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
            'ingest_total_failed{node_id="bRcKq5zUTAuwNf4qvnXzIQ",node_name="bRcKq5z"}': 0,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_bad_chars(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "1-group-filter-1": {
        #             "filters": {
        #                 "filters": {
        #                     "group_a": {"term": {"group1": "a"}},
        #                     "group_b": {"term": {"group1": "b"}}
        #                 }
        #             },
        #             "aggs": {
        #                 "val_sum": {
        #                     "sum": {"field": "val"}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "1-group-filter-1": {
                    "buckets": {
                        "group_a": {
                            "doc_count": 2,
                            "val_sum": {
                                "value": 3.0
                            }
                        },
                        "group_b": {
                            "doc_count": 1,
                            "val_sum": {
                                "value": 3.0
                            }
                        }
                    }
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 1,
            '__group_filter_1_doc_count{_group_filter_1="group_a"}': 2,
            '__group_filter_1_doc_count{_group_filter_1="group_b"}': 1,
            '__group_filter_1_val_sum_value{_group_filter_1="group_a"}': 3.0,
            '__group_filter_1_val_sum_value{_group_filter_1="group_b"}': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_composite(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "group_comp": {
        #             "composite": {
        #                 "sources": [
        #                     {"group1": {"terms": {"field": "group1.keyword"}}},
        #                     {"val": {"terms": {"field": "val"}}}
        #                 ]
        #             },
        #             "aggs": {
        #                 "val_sum": {
        #                     "sum": {"field": "val"}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "total": 1,
                "successful": 1,
                "skipped": 0,
                "failed": 0
            },
            "aggregations": {
                "group_comp": {
                    "after_key": {
                        "group1": "b",
                        "val": 3
                    },
                    "buckets": [{
                        "doc_count": 1,
                        "key": {
                            "group1": "a",
                            "val": 1
                        },
                        "val_sum": {
                            "value": 1
                        }
                    }, {
                        "doc_count": 1,
                        "key": {
                            "group1": "a",
                            "val": 2
                        },
                        "val_sum": {
                            "value": 2
                        }
                    }, {
                        "doc_count": 1,
                        "key": {
                            "group1": "b",
                            "val": 3
                        },
                        "val_sum": {
                            "value": 3
                        }
                    }]
                }
            },
            "hits": {
                "hits": [],
                "max_score": None,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 3
        }

        expected = {
            'hits':
            3,
            'took_milliseconds':
            3,
            'group_comp_doc_count{group_comp_group1="a",group_comp_val="1"}':
            1,
            'group_comp_val_sum_value{group_comp_group1="a",group_comp_val="1"}':
            1,
            'group_comp_doc_count{group_comp_group1="a",group_comp_val="2"}':
            1,
            'group_comp_val_sum_value{group_comp_group1="a",group_comp_val="2"}':
            2,
            'group_comp_doc_count{group_comp_group1="b",group_comp_val="3"}':
            1,
            'group_comp_val_sum_value{group_comp_group1="b",group_comp_val="3"}':
            3,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_nested_terms(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "group1_term": {
        #             "terms": {"field": "group1.keyword"},
        #             "aggs": {
        #                 "val_sum": {
        #                     "sum": {"field": "val"}
        #                 },
        #                 "group2_term": {
        #                     "terms": {"field": "group2.keyword"},
        #                     "aggs": {
        #                         "val_sum": {
        #                             "sum": {"field": "val"}
        #                         }
        #                     }
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "group1_term": {
                    "buckets": [{
                        "doc_count": 2,
                        "group2_term": {
                            "buckets": [{
                                "doc_count": 1,
                                "key": "a",
                                "val_sum": {
                                    "value": 1.0
                                }
                            }, {
                                "doc_count": 1,
                                "key": "b",
                                "val_sum": {
                                    "value": 2.0
                                }
                            }],
                            "doc_count_error_upper_bound":
                            0,
                            "sum_other_doc_count":
                            0
                        },
                        "key": "a",
                        "val_sum": {
                            "value": 3.0
                        }
                    }, {
                        "doc_count": 1,
                        "group2_term": {
                            "buckets": [{
                                "doc_count": 1,
                                "key": "b",
                                "val_sum": {
                                    "value": 3.0
                                }
                            }],
                            "doc_count_error_upper_bound":
                            0,
                            "sum_other_doc_count":
                            0
                        },
                        "key": "b",
                        "val_sum": {
                            "value": 3.0
                        }
                    }],
                    "doc_count_error_upper_bound":
                    0,
                    "sum_other_doc_count":
                    0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 2
        }

        expected = {
            'hits':
            3,
            'took_milliseconds':
            2,
            'group1_term_doc_count_error_upper_bound':
            0,
            'group1_term_sum_other_doc_count':
            0,
            'group1_term_doc_count{group1_term="a"}':
            2,
            'group1_term_val_sum_value{group1_term="a"}':
            3.0,
            'group1_term_group2_term_doc_count_error_upper_bound{group1_term="a"}':
            0,
            'group1_term_group2_term_sum_other_doc_count{group1_term="a"}':
            0,
            'group1_term_group2_term_doc_count{group1_term="a",group2_term="a"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="a",group2_term="a"}':
            1.0,
            'group1_term_group2_term_doc_count{group1_term="a",group2_term="b"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="a",group2_term="b"}':
            2.0,
            'group1_term_doc_count{group1_term="b"}':
            1,
            'group1_term_val_sum_value{group1_term="b"}':
            3.0,
            'group1_term_group2_term_doc_count_error_upper_bound{group1_term="b"}':
            0,
            'group1_term_group2_term_sum_other_doc_count{group1_term="b"}':
            0,
            'group1_term_group2_term_doc_count{group1_term="b",group2_term="b"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="b",group2_term="b"}':
            3.0,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
    def test_terms_numeric(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "val_terms": {
        #             "terms": {"field": "val"},
        #             "aggs": {
        #                 "val_sum": {
        #                     "sum": {"field": "val"}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "total": 5,
                "successful": 5,
                "failed": 0
            },
            "aggregations": {
                "val_terms": {
                    "doc_count_error_upper_bound":
                    0,
                    "sum_other_doc_count":
                    0,
                    "buckets": [{
                        "key": 1,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 1.0
                        }
                    }, {
                        "key": 2,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 2.0
                        }
                    }, {
                        "key": 3,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 3.0
                        }
                    }]
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 3
                }
            },
            "timed_out": False,
            "took": 4
        }

        expected = {
            'hits': 3,
            'took_milliseconds': 4,
            'val_terms_doc_count_error_upper_bound': 0,
            'val_terms_sum_other_doc_count': 0,
            'val_terms_doc_count{val_terms="1"}': 1,
            'val_terms_val_sum_value{val_terms="1"}': 1.0,
            'val_terms_doc_count{val_terms="2"}': 1,
            'val_terms_val_sum_value{val_terms="2"}': 2.0,
            'val_terms_doc_count{val_terms="3"}': 1,
            'val_terms_val_sum_value{val_terms="3"}': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #24
0
    def test_filters_anonymous(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'group_filter': {
        #             'filters': {
        #                 'filters': [
        #                     {'term': {'group1': 'a'}},
        #                     {'term': {'group1': 'b'}}
        #                 ]
        #             },
        #             'aggs': {
        #                 'val_sum': {
        #                     'sum': {'field': 'val'}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "group_filter": {
                    "buckets": [{
                        "doc_count": 2,
                        "val_sum": {
                            "value": 3.0
                        }
                    }, {
                        "doc_count": 1,
                        "val_sum": {
                            "value": 3.0
                        }
                    }]
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 3,
            'group_filter_doc_count{group_filter="filter_0"}': 2,
            'group_filter_doc_count{group_filter="filter_1"}': 1,
            'group_filter_val_sum_value{group_filter="filter_0"}': 3.0,
            'group_filter_val_sum_value{group_filter="filter_1"}': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
    def test_datefield_extended_stats(self):
        # Query:
        # {
        #     "size": 0,
        #     "query": {
        #         "match_all": {}
        #     },
        #     "aggs": {
        #         "val_extended_stats": {
        #             "extended_stats": {"field": "dateval"}
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "val_extended_stats": {
                    "avg": 1546300800000,
                    "avg_as_string": "2019-01-01T00:00:00.000Z",
                    "count": 1,
                    "max": 1546300800000,
                    "max_as_string": "2019-01-01T00:00:00.000Z",
                    "min": 1546300800000,
                    "min_as_string": "2019-01-01T00:00:00.000Z",
                    "std_deviation": 0,
                    "std_deviation_as_string": "1970-01-01T00:00:00.000Z",
                    "std_deviation_bounds": {
                        "upper": 1546300800000,
                        "lower": 1546300800000
                    },
                    "std_deviation_bounds_as_string": {
                        "upper": "2019-01-01T00:00:00.000Z",
                        "lower": "2019-01-01T00:00:00.000Z"
                    },
                    "sum": 1546300800000,
                    "sum_as_string": "2019-01-01T00:00:00.000Z",
                    "sum_of_squares": 2.39104616408064e+24,
                    "sum_of_squares_as_string":
                    "292278994-08-17T07:12:55.807Z",
                    "variance": 0,
                    "variance_as_string": "1970-01-01T00:00:00.000Z"
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": {
                    "relation": "eq",
                    "value": 4
                }
            },
            "timed_out": False,
            "took": 1
        }

        expected = {
            'hits': 4,
            'took_milliseconds': 1,
            'val_extended_stats_avg': 1546300800000,
            'val_extended_stats_count': 1,
            'val_extended_stats_max': 1546300800000,
            'val_extended_stats_min': 1546300800000,
            'val_extended_stats_sum': 1546300800000,
            'val_extended_stats_std_deviation': 0,
            'val_extended_stats_std_deviation_bounds_upper': 1546300800000,
            'val_extended_stats_std_deviation_bounds_lower': 1546300800000,
            'val_extended_stats_sum_of_squares': 2.39104616408064e+24,
            'val_extended_stats_variance': 0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(expected, result)
Beispiel #26
0
    def test_terms_numeric(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'val_terms': {
        #             'terms': {'field': 'val'},
        #             'aggs': {
        #                 'val_sum': {
        #                     'sum': {'field': 'val'}
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "total": 5,
                "successful": 5,
                "failed": 0
            },
            "aggregations": {
                "val_terms": {
                    "doc_count_error_upper_bound":
                    0,
                    "sum_other_doc_count":
                    0,
                    "buckets": [{
                        "key": 1,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 1.0
                        }
                    }, {
                        "key": 2,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 2.0
                        }
                    }, {
                        "key": 3,
                        "doc_count": 1,
                        "val_sum": {
                            "value": 3.0
                        }
                    }]
                }
            },
            "hits": {
                "total": 3,
                "max_score": 0.0,
                "hits": []
            },
            "timed_out": False,
            "took": 4
        }

        expected = {
            'hits': 3,
            'val_terms_doc_count_error_upper_bound': 0,
            'val_terms_sum_other_doc_count': 0,
            'val_terms_doc_count{val_terms="1"}': 1,
            'val_terms_val_sum_value{val_terms="1"}': 1.0,
            'val_terms_doc_count{val_terms="2"}': 1,
            'val_terms_val_sum_value{val_terms="2"}': 2.0,
            'val_terms_doc_count{val_terms="3"}': 1,
            'val_terms_val_sum_value{val_terms="3"}': 3.0
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)
Beispiel #27
0
    def test_nested_terms(self):
        # Query:
        # {
        #     'size': 0,
        #     'query': {
        #         'match_all': {}
        #     },
        #     'aggs': {
        #         'group1_term': {
        #             'terms': {'field': 'group1'},
        #             'aggs': {
        #                 'val_sum': {
        #                     'sum': {'field': 'val'}
        #                 },
        #                 'group2_term': {
        #                     'terms': {'field': 'group2'},
        #                     'aggs': {
        #                         'val_sum': {
        #                             'sum': {'field': 'val'}
        #                         }
        #                     }
        #                 }
        #             }
        #         }
        #     }
        # }
        response = {
            "_shards": {
                "failed": 0,
                "successful": 5,
                "total": 5
            },
            "aggregations": {
                "group1_term": {
                    "buckets": [{
                        "doc_count": 2,
                        "group2_term": {
                            "buckets": [{
                                "doc_count": 1,
                                "key": "a",
                                "val_sum": {
                                    "value": 1.0
                                }
                            }, {
                                "doc_count": 1,
                                "key": "b",
                                "val_sum": {
                                    "value": 2.0
                                }
                            }],
                            "doc_count_error_upper_bound":
                            0,
                            "sum_other_doc_count":
                            0
                        },
                        "key": "a",
                        "val_sum": {
                            "value": 3.0
                        }
                    }, {
                        "doc_count": 1,
                        "group2_term": {
                            "buckets": [{
                                "doc_count": 1,
                                "key": "b",
                                "val_sum": {
                                    "value": 3.0
                                }
                            }],
                            "doc_count_error_upper_bound":
                            0,
                            "sum_other_doc_count":
                            0
                        },
                        "key": "b",
                        "val_sum": {
                            "value": 3.0
                        }
                    }],
                    "doc_count_error_upper_bound":
                    0,
                    "sum_other_doc_count":
                    0
                }
            },
            "hits": {
                "hits": [],
                "max_score": 0.0,
                "total": 3
            },
            "timed_out": False,
            "took": 2
        }

        expected = {
            'hits':
            3,
            'group1_term_doc_count_error_upper_bound':
            0,
            'group1_term_sum_other_doc_count':
            0,
            'group1_term_doc_count{group1_term="a"}':
            2,
            'group1_term_val_sum_value{group1_term="a"}':
            3.0,
            'group1_term_group2_term_doc_count_error_upper_bound{group1_term="a"}':
            0,
            'group1_term_group2_term_sum_other_doc_count{group1_term="a"}':
            0,
            'group1_term_group2_term_doc_count{group1_term="a",group2_term="a"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="a",group2_term="a"}':
            1.0,
            'group1_term_group2_term_doc_count{group1_term="a",group2_term="b"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="a",group2_term="b"}':
            2.0,
            'group1_term_doc_count{group1_term="b"}':
            1,
            'group1_term_val_sum_value{group1_term="b"}':
            3.0,
            'group1_term_group2_term_doc_count_error_upper_bound{group1_term="b"}':
            0,
            'group1_term_group2_term_sum_other_doc_count{group1_term="b"}':
            0,
            'group1_term_group2_term_doc_count{group1_term="b",group2_term="b"}':
            1,
            'group1_term_group2_term_val_sum_value{group1_term="b",group2_term="b"}':
            3.0,
        }
        result = convert_result(parse_response(response))
        self.assertEqual(result, expected)