{"action":"created","issue":{"url":"https://api.github.com/repos/grafana/grafana/issues/8009","repository_url":"https://api.github.com/repos/grafana/grafana","labels_url":"https://api.github.com/repos/grafana/grafana/issues/8009/labels{/name}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/8009/comments","events_url":"https://api.github.com/repos/grafana/grafana/issues/8009/events","html_url":"https://github.com/grafana/grafana/issues/8009","id":218853358,"number":8009,"title":"Lucene queries","user":{"login":"izenk","id":6417697,"avatar_url":"https://avatars1.githubusercontent.com/u/6417697?v=3","gravatar_id":"","url":"https://api.github.com/users/izenk","html_url":"https://github.com/izenk","followers_url":"https://api.github.com/users/izenk/followers","following_url":"https://api.github.com/users/izenk/following{/other_user}","gists_url":"https://api.github.com/users/izenk/gists{/gist_id}","starred_url":"https://api.github.com/users/izenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izenk/subscriptions","organizations_url":"https://api.github.com/users/izenk/orgs","repos_url":"https://api.github.com/users/izenk/repos","events_url":"https://api.github.com/users/izenk/events{/privacy}","received_events_url":"https://api.github.com/users/izenk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-03T07:46:33Z","updated_at":"2017-04-03T07:50:51Z","closed_at":"2017-04-03T07:50:51Z","body":"Hello\r\n\r\n- Grafana: 4.2.0\r\n- datasource elasticsearch 5.2\r\n- OS: Ubuntu 14.04 x64\r\n\r\nI'm trying to configure dashboard with table panel:\r\n\r\nI found example of lucene query in grafana docs: https://grafana.com/blog/2016/03/09/how-to-effectively-use-the-elasticsearch-data-source-in-grafana-and-solutions-to-common-pitfalls/#templated\r\n\r\nLucene query: {“find”: “terms”, “field”: “role_host”, “query”: “role: db”}\r\n\r\nquery from dev tools this query looks like:\r\n```json\r\n{\"search_type\":\"query_then_fetch\",\"ignore_unavailable\":true,\"index\":[\"metricbeat-2017.04.02\",\"metricbeat-2017.04.03\"]}\r\n{\"size\":0,\"query\":{\"bool\":{\"filter\":[{\"range\":{\"@timestamp\":{\"gte\":\"1491166800000\",\"lte\":\"1495258199999\",\"format\":\"epoch_millis\"}}},{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}\"}}]}},\"aggs\":{\"8\":{\"date_histogram\":{\"interval\":\"1m\",\"field\":\"@timestamp\",\"min_doc_count\":0,\"extended_bounds\":{\"min\":\"1491166800000\",\"max\":\"1491253199999\"},\"format\":\"epoch_millis\"},\"aggs\":{}}}}\r\n```\r\n\r\nIn grafana UI I get error (from dev tools):\r\n```json\r\n\"{\r\n    \"root_cause\": [\r\n        {\r\n            \"type\": \"parse_exception\",\r\n            \"reason\": \"parse_exception: Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \"\r\n        },\r\n        {\r\n            \"type\": \"parse_exception\",\r\n            \"reason\": \"parse_exception: Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \"\r\n        }\r\n    ],\r\n    \"type\": \"search_phase_execution_exception\",\r\n    \"reason\": \"all shards failed\",\r\n    \"phase\": \"query\",\r\n    \"grouped\": true,\r\n    \"failed_shards\": [\r\n        {\r\n            \"shard\": 0,\r\n            \"index\": \"metricbeat-2017.04.02\",\r\n            \"node\": \"TMte84SpSzm-0xFRPLIkyw\",\r\n            \"reason\": {\r\n                \"type\": \"query_shard_exception\",\r\n                \"reason\": \"Failed to parse query [{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}]\",\r\n                \"index_uuid\": \"eCYTRvciTRm7ft2MLO6Faw\",\r\n                \"index\": \"metricbeat-2017.04.02\",\r\n                \"caused_by\": {\r\n                    \"type\": \"parse_exception\",\r\n                    \"reason\": \"parse_exception: Cannot parse '{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}': Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \",\r\n                    \"caused_by\": {\r\n                        \"type\": \"parse_exception\",\r\n                        \"reason\": \"parse_exception: Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \"\r\n                    }\r\n                }\r\n            }\r\n        },\r\n        {\r\n            \"shard\": 0,\r\n            \"index\": \"metricbeat-2017.04.03\",\r\n            \"node\": \"TMte84SpSzm-0xFRPLIkyw\",\r\n            \"reason\": {\r\n                \"type\": \"query_shard_exception\",\r\n                \"reason\": \"Failed to parse query [{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}]\",\r\n                \"index_uuid\": \"rrMkdo22SGGoaskmIGsrug\",\r\n                \"index\": \"metricbeat-2017.04.03\",\r\n                \"caused_by\": {\r\n                    \"type\": \"parse_exception\",\r\n                    \"reason\": \"parse_exception: Cannot parse '{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}': Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \",\r\n                    \"caused_by\": {\r\n                        \"type\": \"parse_exception\",\r\n                        \"reason\": \"parse_exception: Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \"\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    ],\r\n    \"caused_by\": {\r\n        \"type\": \"query_shard_exception\",\r\n        \"reason\": \"Failed to parse query [{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}]\",\r\n        \"index_uuid\": \"rrMkdo22SGGoaskmIGsrug\",\r\n        \"index\": \"metricbeat-2017.04.03\",\r\n        \"caused_by\": {\r\n            \"type\": \"parse_exception\",\r\n            \"reason\": \"parse_exception: Cannot parse '{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}': Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \",\r\n            \"caused_by\": {\r\n                \"type\": \"parse_exception\",\r\n                \"reason\": \"parse_exception: Encountered \\\" <RANGE_GOOP> \\\"\\\\\\\"field\\\\\\\": \\\"\\\" at line 1, column 18.\\nWas expecting one of:\\n    \\\"]\\\" ...\\n    \\\"}\\\" ...\\n    \"\r\n            }\r\n        }\r\n    }\r\n}\"\r\n```\r\n\r\nAt the same time, if I copy request body from dev tools and pass it to curl, there are no any errors:\r\n```\r\ncurl  'http://x.x.x.x:9200/activities_production/activity/_msearch' -d '\r\n{\"search_type\":\"query_then_fetch\",\"ignore_unavailable\":true,\"index\":[\"metricbeat-2017.04.02\",\"metricbeat-2017.04.03\"]}\r\n{\"size\":0,\"query\":{\"bool\":{\"filter\":[{\"range\":{\"@timestamp\":{\"gte\":\"1491166800000\",\"lte\":\"1495258199999\",\"format\":\"epoch_millis\"}}},{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"{\\\"find\\\": \\\"terms\\\", \\\"field\\\": \\\"role_host\\\",\\\"query\\\":\\\"role:db\\\"}\"}}]}},\"aggs\":{\"8\":{\"date_histogram\":{\"interval\":\"1m\",\"field\":\"@timestamp\",\"min_doc_count\":0,\"extended_bounds\":{\"min\":\"1491166800000\",\"max\":\"1491253199999\"},\"format\":\"epoch_millis\"},\"aggs\":{}}}}\r\n'\r\n```\r\nresult:\r\n```\r\n{\"responses\":[{\"took\":1,\"timed_out\":false,\"_shards\":{\"total\":0,\"successful\":0,\"failed\":0},\"hits\":{\"total\":0,\"max_score\":0.0,\"hits\":[]},\"status\":200}]}\r\n```"},"comment":{"url":"https://api.github.com/repos/grafana/grafana/issues/comments/291071940","html_url":"https://github.com/grafana/grafana/issues/8009#issuecomment-291071940","issue_url":"https://api.github.com/repos/grafana/grafana/issues/8009","id":291071940,"user":{"login":"torkelo","id":10999,"avatar_url":"https://avatars0.githubusercontent.com/u/10999?v=3","gravatar_id":"","url":"https://api.github.com/users/torkelo","html_url":"https://github.com/torkelo","followers_url":"https://api.github.com/users/torkelo/followers","following_url":"https://api.github.com/users/torkelo/following{/other_user}","gists_url":"https://api.github.com/users/torkelo/gists{/gist_id}","starred_url":"https://api.github.com/users/torkelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkelo/subscriptions","organizations_url":"https://api.github.com/users/torkelo/orgs","repos_url":"https://api.github.com/users/torkelo/repos","events_url":"https://api.github.com/users/torkelo/events{/privacy}","received_events_url":"https://api.github.com/users/torkelo/received_events","type":"User","site_admin":false},"created_at":"2017-04-03T07:50:51Z","updated_at":"2017-04-03T07:50:51Z","body":"If your in the metrics tab of panel you should just include the query part `role:db` in the query input field. \r\n\r\nThe ` {“find”: “terms”, “field”: “role_host”, “query”: “role: db”}` is for use only in the template variable query field. "}}
{"actor":{"display_login":"torkelo"}}