简体   繁体   English

elasticsearch-dsl-py 中的 GeoPoint 字段类型

[英]GeoPoint field type in elasticsearch-dsl-py

I'm using elasticsearch-dsl-py 0.0.11 for ES 1.7 and I want to add a GeoPoint type as listed in fields.py :我正在为ES 1.7使用elasticsearch-dsl-py 0.0.11 ,并且我想添加fields.py列出的GeoPoint类型:

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

But no class named GeoPoint exists and I cannot create a mapping for a location field like this:但是不存在名为GeoPoint类,我无法为这样的位置字段创建映射:

location = GeoPoint()

What should I do?我该怎么办?

You need to make sure to import GeoPoint like this您需要确保像这样导入GeoPoint

from elasticsearch_dsl import GeoPoint

Then you can declare your location field as然后您可以将您的位置字段声明为

location = GeoPoint()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM