{"action":"created","issue":{"url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/16","labels_url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/16/comments","events_url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/16/events","html_url":"https://github.com/markkimsal/statsd-elasticsearch-backend/pull/16","id":69015670,"number":16,"title":"Regex key parsing","user":{"login":"pib","id":32910,"avatar_url":"https://avatars.githubusercontent.com/u/32910?v=3","gravatar_id":"","url":"https://api.github.com/users/pib","html_url":"https://github.com/pib","followers_url":"https://api.github.com/users/pib/followers","following_url":"https://api.github.com/users/pib/following{/other_user}","gists_url":"https://api.github.com/users/pib/gists{/gist_id}","starred_url":"https://api.github.com/users/pib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pib/subscriptions","organizations_url":"https://api.github.com/users/pib/orgs","repos_url":"https://api.github.com/users/pib/repos","events_url":"https://api.github.com/users/pib/events{/privacy}","received_events_url":"https://api.github.com/users/pib/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-16T21:39:47Z","updated_at":"2015-04-17T16:49:03Z","closed_at":"2015-04-17T16:49:03Z","pull_request":{"url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/pulls/16","html_url":"https://github.com/markkimsal/statsd-elasticsearch-backend/pull/16","diff_url":"https://github.com/markkimsal/statsd-elasticsearch-backend/pull/16.diff","patch_url":"https://github.com/markkimsal/statsd-elasticsearch-backend/pull/16.patch"},"body":"This will allow for arbitrary structure of keys and arbitrary field names to be inserted into ElasticSearch. The default retains the current functionality, and the functionality that #15 implements can be replicated by setting keyRegex in the config to `/^(:<ns>[^.]+)\\.(:<grp>[^.]+)\\.(:<tgt>[^.]+)(?:\\.(:<act>.+))?/`.\r\n\r\nIt uses https://www.npmjs.com/package/named-regexp to add named captures to regexes. It seems worth it to add the dependency to get the configurability of key parsing with so little effort.\r\n\r\nIn my use case, I have weird legacy keys in the form\r\n\r\n`appname.type.impressions.0.0.0.0.1.12345.count`,\r\n\r\nso I am using a regex like\r\n\r\n`/^(:<app>[^.]+)\\.(:<data_type>[^.]+)\\.(:<view_type>[^.]+)\\.\\d\\.\\d\\.\\d\\.\\d\\.\\d\\.(:<data_id>\\d+)\\.(:<stat_type>[^.]+)/`.\r\n\r\n It's kind of verbose, but it's understandable and does the job."},"comment":{"url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/comments/94025417","html_url":"https://github.com/markkimsal/statsd-elasticsearch-backend/pull/16#issuecomment-94025417","issue_url":"https://api.github.com/repos/markkimsal/statsd-elasticsearch-backend/issues/16","id":94025417,"user":{"login":"markkimsal","id":54099,"avatar_url":"https://avatars.githubusercontent.com/u/54099?v=3","gravatar_id":"","url":"https://api.github.com/users/markkimsal","html_url":"https://github.com/markkimsal","followers_url":"https://api.github.com/users/markkimsal/followers","following_url":"https://api.github.com/users/markkimsal/following{/other_user}","gists_url":"https://api.github.com/users/markkimsal/gists{/gist_id}","starred_url":"https://api.github.com/users/markkimsal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markkimsal/subscriptions","organizations_url":"https://api.github.com/users/markkimsal/orgs","repos_url":"https://api.github.com/users/markkimsal/repos","events_url":"https://api.github.com/users/markkimsal/events{/privacy}","received_events_url":"https://api.github.com/users/markkimsal/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T16:49:03Z","updated_at":"2015-04-17T16:49:03Z","body":"I have re-coded your changes as a separate and configurable key formatter module.\r\nEven the default behavior of this PR was identical to the behavior #15 I still felt like it was time to make the choices of how to map keys to ES documents into configurable modules."}}