{"action":"created","issue":{"url":"https://api.github.com/repos/zombodb/zombodb/issues/239","repository_url":"https://api.github.com/repos/zombodb/zombodb","labels_url":"https://api.github.com/repos/zombodb/zombodb/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/zombodb/zombodb/issues/239/comments","events_url":"https://api.github.com/repos/zombodb/zombodb/issues/239/events","html_url":"https://github.com/zombodb/zombodb/issues/239","id":282874542,"number":239,"title":"JSON fields indexed as text rather than keyword? ","user":{"login":"joelkuiper","id":971293,"avatar_url":"https://avatars3.githubusercontent.com/u/971293?v=4","gravatar_id":"","url":"https://api.github.com/users/joelkuiper","html_url":"https://github.com/joelkuiper","followers_url":"https://api.github.com/users/joelkuiper/followers","following_url":"https://api.github.com/users/joelkuiper/following{/other_user}","gists_url":"https://api.github.com/users/joelkuiper/gists{/gist_id}","starred_url":"https://api.github.com/users/joelkuiper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelkuiper/subscriptions","organizations_url":"https://api.github.com/users/joelkuiper/orgs","repos_url":"https://api.github.com/users/joelkuiper/repos","events_url":"https://api.github.com/users/joelkuiper/events{/privacy}","received_events_url":"https://api.github.com/users/joelkuiper/received_events","type":"User","site_admin":false},"labels":[{"id":237486354,"url":"https://api.github.com/repos/zombodb/zombodb/labels/bug","name":"bug","color":"fc2929","default":true},{"id":783249892,"url":"https://api.github.com/repos/zombodb/zombodb/labels/v5.6.4-1.0.0_beta2","name":"v5.6.4-1.0.0_beta2","color":"1d76db","default":false}],"state":"closed","locked":false,"assignee":{"login":"eeeebbbbrrrr","id":5117238,"avatar_url":"https://avatars3.githubusercontent.com/u/5117238?v=4","gravatar_id":"","url":"https://api.github.com/users/eeeebbbbrrrr","html_url":"https://github.com/eeeebbbbrrrr","followers_url":"https://api.github.com/users/eeeebbbbrrrr/followers","following_url":"https://api.github.com/users/eeeebbbbrrrr/following{/other_user}","gists_url":"https://api.github.com/users/eeeebbbbrrrr/gists{/gist_id}","starred_url":"https://api.github.com/users/eeeebbbbrrrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eeeebbbbrrrr/subscriptions","organizations_url":"https://api.github.com/users/eeeebbbbrrrr/orgs","repos_url":"https://api.github.com/users/eeeebbbbrrrr/repos","events_url":"https://api.github.com/users/eeeebbbbrrrr/events{/privacy}","received_events_url":"https://api.github.com/users/eeeebbbbrrrr/received_events","type":"User","site_admin":false},"assignees":[{"login":"eeeebbbbrrrr","id":5117238,"avatar_url":"https://avatars3.githubusercontent.com/u/5117238?v=4","gravatar_id":"","url":"https://api.github.com/users/eeeebbbbrrrr","html_url":"https://github.com/eeeebbbbrrrr","followers_url":"https://api.github.com/users/eeeebbbbrrrr/followers","following_url":"https://api.github.com/users/eeeebbbbrrrr/following{/other_user}","gists_url":"https://api.github.com/users/eeeebbbbrrrr/gists{/gist_id}","starred_url":"https://api.github.com/users/eeeebbbbrrrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eeeebbbbrrrr/subscriptions","organizations_url":"https://api.github.com/users/eeeebbbbrrrr/orgs","repos_url":"https://api.github.com/users/eeeebbbbrrrr/repos","events_url":"https://api.github.com/users/eeeebbbbrrrr/events{/privacy}","received_events_url":"https://api.github.com/users/eeeebbbbrrrr/received_events","type":"User","site_admin":false}],"milestone":null,"comments":21,"created_at":"2017-12-18T13:12:48Z","updated_at":"2017-12-20T22:27:26Z","closed_at":"2017-12-19T21:23:41Z","author_association":"NONE","body":"We're trying to use the ES aggregations on the new 5.6.4 beta release, however we stumbled on an oddity \r\n\r\n```\r\nselect * from zdb_arbitrary_aggregate('articles', \r\n'#json_agg({\r\n  \"significant\": {\r\n    \"significant_terms\": {\r\n      \"mutual_information\": {\r\n        \"include_negatives\": true\r\n      },\r\n      \"field\": \"subjs.id\",\r\n      \"size\": 25\r\n    }\r\n  }\r\n})',\r\n' <query here>');\r\n```\r\n\r\nyields \r\n\r\n> Fielddata is disabled on text fields by default. Set fielddata=true on [subjs.id] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.\r\n\r\n(related https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html) \r\n\r\nHowever the type mapping for `subjs` is `json` with the child `id` being a simple string. From the documentation this should be analyzed as a keyword, but seems to be text. Worked fine in the 1.7 version. Am I missing something or is this an actual issue?"},"comment":{"url":"https://api.github.com/repos/zombodb/zombodb/issues/comments/353201124","html_url":"https://github.com/zombodb/zombodb/issues/239#issuecomment-353201124","issue_url":"https://api.github.com/repos/zombodb/zombodb/issues/239","id":353201124,"user":{"login":"eeeebbbbrrrr","id":5117238,"avatar_url":"https://avatars3.githubusercontent.com/u/5117238?v=4","gravatar_id":"","url":"https://api.github.com/users/eeeebbbbrrrr","html_url":"https://github.com/eeeebbbbrrrr","followers_url":"https://api.github.com/users/eeeebbbbrrrr/followers","following_url":"https://api.github.com/users/eeeebbbbrrrr/following{/other_user}","gists_url":"https://api.github.com/users/eeeebbbbrrrr/gists{/gist_id}","starred_url":"https://api.github.com/users/eeeebbbbrrrr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eeeebbbbrrrr/subscriptions","organizations_url":"https://api.github.com/users/eeeebbbbrrrr/orgs","repos_url":"https://api.github.com/users/eeeebbbbrrrr/repos","events_url":"https://api.github.com/users/eeeebbbbrrrr/events{/privacy}","received_events_url":"https://api.github.com/users/eeeebbbbrrrr/received_events","type":"User","site_admin":false},"created_at":"2017-12-20T22:27:26Z","updated_at":"2017-12-20T22:27:26Z","author_association":"COLLABORATOR","body":"I think I'm just arguing with myself at this point, but it looks like this is possible after all.  I can add a default field to every `nested` object mapping called `zdb_always_exists` and set its `null_value` property to `true`.  \r\n\r\nThis will create that field for only top-level documents whose nested json field is non-null.  Then it's just a matter of some boolean query gymnastics in order to preserve the `json_field = NULL` ability.\r\n\r\nI'm going to keep testing, but so far so good. "}}
{"actor":{"display_login":"eeeebbbbrrrr"}}