Python elasticsearch_dsl 模块,GeoPoint() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用elasticsearch_dsl.GeoPoint()

项目:django-elasticsearch-dsl    作者:sabricot    | 项目源码 | 文件源码
def test_prepare_ignore_dsl_base_field(self):
        class CarDocumentDSlBaseField(DocType):
            position = GeoPoint()

            class Meta:
                model = Car
                index = 'car_index'
                fields = ['name', 'price']

        car = Car(name="Type 57", price=5400000.0, not_indexed="not_indexex")
        doc = CarDocumentDSlBaseField()
        prepared_data = doc.prepare(car)
        self.assertEqual(
            prepared_data, {
                'name': car.name,
                'price': car.price
            }
        )