2

我正在使用elasticsearch-dsl-py 0.0.11forES 1.7并且我想添加GeoPoint如下所列的类型fields.py

__all__ = [
    'construct_field', 'Field', 'Object', 'Nested', 'Date', 'String', 'Float', 'Double',
    'Byte', 'Short', 'Integer', 'Long', 'Boolean', 'Ip', 'Attachment',
    'GeoPoint', 'GeoShape', 'InnerObjectWrapper'
]

但是不GeoPoint存在名为的类,我无法为这样的位置字段创建映射:

location = GeoPoint()

我应该怎么办?

4

1 回答 1

2

您需要确保GeoPoint像这样导入

from elasticsearch_dsl import GeoPoint

然后您可以将您的位置字段声明为

location = GeoPoint()
于 2016-05-08T16:37:37.793 回答