Open alaa-jaradat opened 5 years ago
Same problem here!
For those who are interested, this is how I "fix" it:
@registry.register_document
class BusinessDocument(Document):
geocoords = fields.GeoPointField()
def prepare_geocoords(self, instance: Business) -> Dict:
return {
'lon': instance.geocoords.x,
'lat': instance.geocoords.y
}
Hope that'll help you.
I am trying to map gis PointField to elastricsearch index but i am receiving this error: TypeError("Unable to serialize <Point object at 0x1fb67301990> (type: <class 'django.contrib.gis.geos.point.Point'>)",))
Does this library support this type of gis model field ?
My model.py: from django.db import models _from django.contrib.gis.db import models as gismodels from django.db.models import Manager as GeoManager
_class Places(models.Model): location = gis_models.PointField(srid=4326, null=True, blank=True)__
My documents.py:
_from django_elasticsearch_dsl import Document, fields from django_elasticsearchdsl.registries import registry
_from .models import Places @registry.registerdocument class PlacesDocument(Document): location = fields.GeoPointField()