{"action":"created","issue":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/58","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/58/comments","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/58/events","html_url":"https://github.com/elasticsearch/elasticsearch-dsl-py/issues/58","id":55373672,"number":58,"title":"Accessing and setting document metadata directly vs through `_meta`","user":{"login":"dcwatson","id":293445,"avatar_url":"https://avatars.githubusercontent.com/u/293445?v=3","gravatar_id":"","url":"https://api.github.com/users/dcwatson","html_url":"https://github.com/dcwatson","followers_url":"https://api.github.com/users/dcwatson/followers","following_url":"https://api.github.com/users/dcwatson/following{/other_user}","gists_url":"https://api.github.com/users/dcwatson/gists{/gist_id}","starred_url":"https://api.github.com/users/dcwatson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcwatson/subscriptions","organizations_url":"https://api.github.com/users/dcwatson/orgs","repos_url":"https://api.github.com/users/dcwatson/repos","events_url":"https://api.github.com/users/dcwatson/events{/privacy}","received_events_url":"https://api.github.com/users/dcwatson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"HonzaKral","id":32132,"avatar_url":"https://avatars.githubusercontent.com/u/32132?v=3","gravatar_id":"","url":"https://api.github.com/users/HonzaKral","html_url":"https://github.com/HonzaKral","followers_url":"https://api.github.com/users/HonzaKral/followers","following_url":"https://api.github.com/users/HonzaKral/following{/other_user}","gists_url":"https://api.github.com/users/HonzaKral/gists{/gist_id}","starred_url":"https://api.github.com/users/HonzaKral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HonzaKral/subscriptions","organizations_url":"https://api.github.com/users/HonzaKral/orgs","repos_url":"https://api.github.com/users/HonzaKral/repos","events_url":"https://api.github.com/users/HonzaKral/events{/privacy}","received_events_url":"https://api.github.com/users/HonzaKral/received_events","type":"User","site_admin":false},"milestone":null,"comments":15,"created_at":"2015-01-24T15:04:19Z","updated_at":"2015-02-11T04:37:50Z","closed_at":"2015-01-30T03:16:06Z","body":"If you define a \"score\" field on a DocType, the ``_meta.score`` attribute is set to the document value rather than the ``_score`` attribute of the ES hit. I think this is due to ``ObjectBase.__init__`` calling setattr, and the ``__setattr__`` of DocType making a special case for META_FIELDS (which include \"score\") to set attributes on ``_meta``. I'd imagine this is the case for any document field with the same name as a meta field.\r\n\r\nIt seems like DocType shouldn't try to expose/set ``_meta`` attributes directly. Or at least document which field names are not allowed on a DocType and raise an error if you try to define one that conflicts with ``_meta``."},"comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/comments/73833334","html_url":"https://github.com/elasticsearch/elasticsearch-dsl-py/issues/58#issuecomment-73833334","issue_url":"https://api.github.com/repos/elasticsearch/elasticsearch-dsl-py/issues/58","id":73833334,"user":{"login":"HonzaKral","id":32132,"avatar_url":"https://avatars.githubusercontent.com/u/32132?v=3","gravatar_id":"","url":"https://api.github.com/users/HonzaKral","html_url":"https://github.com/HonzaKral","followers_url":"https://api.github.com/users/HonzaKral/followers","following_url":"https://api.github.com/users/HonzaKral/following{/other_user}","gists_url":"https://api.github.com/users/HonzaKral/gists{/gist_id}","starred_url":"https://api.github.com/users/HonzaKral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HonzaKral/subscriptions","organizations_url":"https://api.github.com/users/HonzaKral/orgs","repos_url":"https://api.github.com/users/HonzaKral/repos","events_url":"https://api.github.com/users/HonzaKral/events{/privacy}","received_events_url":"https://api.github.com/users/HonzaKral/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T04:37:50Z","updated_at":"2015-02-11T04:37:50Z","body":"Yes, we need to document it. Though you can still have a field called `meta` and access it via `doc['meta']`\r\n\r\nThanks all for the discussion and design opinions, it made a lot of difference."}}