{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/14273","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14273/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14273/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14273/events","html_url":"https://github.com/elastic/elasticsearch/issues/14273","id":113108661,"number":14273,"title":"Groovy script in aggregation not working in 2.0","user":{"login":"reflection","id":652093,"avatar_url":"https://avatars.githubusercontent.com/u/652093?v=3","gravatar_id":"","url":"https://api.github.com/users/reflection","html_url":"https://github.com/reflection","followers_url":"https://api.github.com/users/reflection/followers","following_url":"https://api.github.com/users/reflection/following{/other_user}","gists_url":"https://api.github.com/users/reflection/gists{/gist_id}","starred_url":"https://api.github.com/users/reflection/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reflection/subscriptions","organizations_url":"https://api.github.com/users/reflection/orgs","repos_url":"https://api.github.com/users/reflection/repos","events_url":"https://api.github.com/users/reflection/events{/privacy}","received_events_url":"https://api.github.com/users/reflection/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Scripting","name":":Scripting","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/bug","name":"bug","color":"9e2c2c"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v2.0.1","name":"v2.0.1","color":"dddddd"}],"state":"open","locked":false,"assignee":{"login":"pickypg","id":1501235,"avatar_url":"https://avatars.githubusercontent.com/u/1501235?v=3","gravatar_id":"","url":"https://api.github.com/users/pickypg","html_url":"https://github.com/pickypg","followers_url":"https://api.github.com/users/pickypg/followers","following_url":"https://api.github.com/users/pickypg/following{/other_user}","gists_url":"https://api.github.com/users/pickypg/gists{/gist_id}","starred_url":"https://api.github.com/users/pickypg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pickypg/subscriptions","organizations_url":"https://api.github.com/users/pickypg/orgs","repos_url":"https://api.github.com/users/pickypg/repos","events_url":"https://api.github.com/users/pickypg/events{/privacy}","received_events_url":"https://api.github.com/users/pickypg/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-10-23T22:09:20Z","updated_at":"2015-10-24T08:47:53Z","closed_at":null,"body":"Here's the aggregation expressed in elasticsearch-dsl-py (which works fine in 1.x):\r\n```\r\ns.aggs \\\r\n  .bucket('hour', 'terms', script= \\\r\n          'use(groovy.time.TimeCategory) { \\\r\n            new Date(doc[\"timestamp\"].value).format(\"HH\") \\\r\n          }', size=0, order={'_term': 'asc'}) \\\r\n  .metric('bandwidth', 'sum', field='size') \\\r\n    .bucket('action', 'terms', field='action', size=0) \\\r\n    .metric('bandwidth', 'sum', field='size')\r\n```\r\nIn 2.0 we get this error:\r\n```\r\nRemoteTransportException[[Longshot][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: \r\nQueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: \r\nGroovyScriptExecutionException[failed to run inline script \r\n[use(groovy.time.TimeCategory) {                 new Date(doc[\"timestamp\"].value).format(\"HH\")               }] using lang [groovy]]; nested: \r\nNoClassDefFoundError[Could not initialize class org.codehaus.groovy.vmplugin.v7.IndyInterface];\r\n```\r\nIf we can no longer use groovy.time.TimeCategory, is there an alternative way to get hour buckets coalesced across multiple days from timestamps?  Thanks in advance!"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/150777269","html_url":"https://github.com/elastic/elasticsearch/issues/14273#issuecomment-150777269","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14273","id":150777269,"user":{"login":"clintongormley","id":56599,"avatar_url":"https://avatars.githubusercontent.com/u/56599?v=3","gravatar_id":"","url":"https://api.github.com/users/clintongormley","html_url":"https://github.com/clintongormley","followers_url":"https://api.github.com/users/clintongormley/followers","following_url":"https://api.github.com/users/clintongormley/following{/other_user}","gists_url":"https://api.github.com/users/clintongormley/gists{/gist_id}","starred_url":"https://api.github.com/users/clintongormley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintongormley/subscriptions","organizations_url":"https://api.github.com/users/clintongormley/orgs","repos_url":"https://api.github.com/users/clintongormley/repos","events_url":"https://api.github.com/users/clintongormley/events{/privacy}","received_events_url":"https://api.github.com/users/clintongormley/received_events","type":"User","site_admin":false},"created_at":"2015-10-24T08:47:53Z","updated_at":"2015-10-24T08:47:53Z","body":"Would a workaround be to delete the indy jar for now?"}}