Skip to content

Commit 65c1846

Browse files
pwalshakariv
andauthored
Support mapping geopoint. (#15)
* Support mapping geopoint. * Fix lint errors Co-authored-by: Adam Kariv <[email protected]>
1 parent 3cb8352 commit 65c1846

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tableschema_elasticsearch/mappers.py

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def _convert_type(cls, schema_type, field, prefix):
8383
'time': {'type': 'date',
8484
'ignore_malformed': True,
8585
'format': cls._convert_date_format(field.get('format'))},
86+
'geopoint': {'type': 'geo_point',
87+
'ignore_malformed': True,
88+
'index': False},
8689
'object': {'properties':
8790
cls._update_properties({}, subschema,
8891
prefix + field['name'] + '.')

tests/test_mappers.py

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def test_descriptor_to_mapping():
2626
{'name': 'another-time', 'type': 'time'},
2727
{'name': 'an-array', 'type': 'array', 'es:itemType': 'string'},
2828
{'name': 'another-array', 'type': 'array', 'es:itemType': 'integer'},
29+
{'name': 'a-geopoint', 'type': 'geopoint'},
2930
{'name': 'an-object', 'type': 'object', 'es:schema': {'fields': [{'name': 'inner', 'type': 'integer'}]}},
3031
{'name': 'another-object', 'type': 'object', 'es:index': False},
3132
]
@@ -44,6 +45,7 @@ def test_descriptor_to_mapping():
4445
'another-time': {'type': 'date', 'ignore_malformed': True, 'format': 'strict_date_optional_time'},
4546
'an-array': {'type': 'text'},
4647
'another-array': {'type': 'long', 'ignore_malformed': True, 'index': False},
48+
'a-geopoint': {'type': 'geo_point', 'ignore_malformed': True,'index': False},
4749
'an-object': {'properties': {'inner': {'type': 'long', 'ignore_malformed': True, 'index': False}},
4850
'enabled': True, 'dynamic': False},
4951
'another-object': {'properties': {}, 'enabled': False, 'dynamic': False}}}

0 commit comments

Comments
 (0)