{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/985","repository_url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py","labels_url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/985/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/985/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/985/events","html_url":"https://github.com/elastic/elasticsearch-dsl-py/issues/985","id":349327717,"node_id":"MDU6SXNzdWUzNDkzMjc3MTc=","number":985,"title":"Incorrect Mapping for Ip field","user":{"login":"zthomas202","id":42255542,"node_id":"MDQ6VXNlcjQyMjU1NTQy","avatar_url":"https://avatars1.githubusercontent.com/u/42255542?v=4","gravatar_id":"","url":"https://api.github.com/users/zthomas202","html_url":"https://github.com/zthomas202","followers_url":"https://api.github.com/users/zthomas202/followers","following_url":"https://api.github.com/users/zthomas202/following{/other_user}","gists_url":"https://api.github.com/users/zthomas202/gists{/gist_id}","starred_url":"https://api.github.com/users/zthomas202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zthomas202/subscriptions","organizations_url":"https://api.github.com/users/zthomas202/orgs","repos_url":"https://api.github.com/users/zthomas202/repos","events_url":"https://api.github.com/users/zthomas202/events{/privacy}","received_events_url":"https://api.github.com/users/zthomas202/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-09T23:39:40Z","updated_at":"2018-08-10T07:14:15Z","closed_at":"2018-08-10T07:14:15Z","author_association":"NONE","body":"I can't seem to get a mapping to an Ip field even if I explicitly cast the data.  Am I misunderstanding the usage of the Ip field?  Here's a code example:\r\n\r\n````python\r\nfrom elasticsearch_dsl import Document, InnerDoc, Nested, Object, Text, Integer, Date, Ip, Float, connections\r\nimport ipaddress\r\n\r\nclass PingPacket(Document):\r\n\tdstIP = Ip()\r\n\ttime = Text()\r\n\tsrcIP = Ip()\r\n\tpacket_type = Text()\r\n\r\n\tclass Index:\r\n\t\tname = \"packet\"\r\n\r\nes = connections.create_connection(hosts=['localhost'])\r\ntestDict = {'1234': {'0': {'latency': 0.123, 'request': {'dstIP': u'192.168.1.1', \\\r\n'srcIP': u'192.168.1.2', 'packet_type': 'echo_request', 'time': 'August 8, 2018 17:30:00'}, \\\r\n'response': {'dstIP': u'192.168.1.2', 'srcIP': u'192.168.1.1', 'packet_type': 'echo_response', \\\r\n'time': 'August 8, 2018 17:30:01'}}}}\r\n\r\nfor pingID, seqDict in testDict.items():\r\n\tfor seqNum, pktsDict in seqDict.items():\r\n\t\trequestPacket = PingPacket(dstIP = ipaddress.ip_address(pktsDict['request']['dstIP']), \\\r\n\t\t\tsrcIP = ipaddress.ip_address(pktsDict['request']['srcIP']), time = pktsDict['request']['time'], packet_type = pktsDict['request']['packet_type'])\r\n\t\tresponsePacket = PingPacket(dstIP = ipaddress.ip_address(pktsDict['response']['dstIP']), \\\r\n\t\t\tsrcIP = ipaddress.ip_address(pktsDict['response']['srcIP']), time = pktsDict['response']['time'], packet_type = pktsDict['response']['packet_type'])\r\n\r\nrequestPacket.save()\r\nprint str(requestPacket._index.get_mapping())\r\n````"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/comments/411996952","html_url":"https://github.com/elastic/elasticsearch-dsl-py/issues/985#issuecomment-411996952","issue_url":"https://api.github.com/repos/elastic/elasticsearch-dsl-py/issues/985","id":411996952,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTk5Njk1Mg==","user":{"login":"HonzaKral","id":32132,"node_id":"MDQ6VXNlcjMyMTMy","avatar_url":"https://avatars0.githubusercontent.com/u/32132?v=4","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":"2018-08-10T07:14:15Z","updated_at":"2018-08-10T07:14:15Z","author_association":"MEMBER","body":"You need to first save the mappings in elasticsearch before you start indexing data that rely on those mappings. calling `PingPacket.init()` before storing any documents should do the trick.\r\n\r\nHope this helps!"}}
{"actor":{"display_login":"HonzaKral"}}