Open Shivendra2407 opened 4 years ago
Hi, Thanks for the reply, really helpful. However, it shows default null for latitude and longitude in models, then when am rebuilding index it gives error of those records that will have None as latitude and longitude. As soon as I put a condition to return 0 as {'lat':0, 'lon':0} in case latitude and longitude are both None, it built index successfully.
How to deal with such situation? Can you please tell. Thanks in advance.
You could either:
P. S. Please, spend time on reading into documentation of this project, Elasticsearch itself and search the internet for solutions.
Thanks a lot @barseghyanartur . Will definitely educate myself more on ES and django-es interaction.
This can be closed now.
I have a model of Location which has the following fields:
And another model City that inherits Location
I am using elasticsearch 6.3.2 and accordingly using django-elasticsearch-dsl and elasticsearch library versions, I have already used in another project so I know it is not compatibility issue of libraries and elasticsearch version. My question in how to use GeoPoint() field. In my document.py file I have:
The latitude and longitude fields I have in model, how will I get them indexed when I use:
python manage.py search_index --rebuild
from terminal. Currently if I do this, only textual fields 'name', 'slug' and 'id' get indexed with each City doc, no location field is there in those docs.
Also, how would I query this using Search object from elasticsearch_dsl .
Appreciate all the help, thanks in advance!