question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GeoPoint not added to mapping

See original GitHub issue
class User(DocType):

    location = GeoPoint()
    session_id = Text()

    class Meta:
        index = 'searching_users'
        dynamic = MetaField('strict')`

I have this class definition, but when I create a user like

user = User()
user.session_id = sid
user.location = [lat, lon]
user.save()`

I am getting

{ "searching_users":{ "mappings":{ "doc":{ "properties":{ "location":{ "type":"long" }, "session_id":{ "type":"text", "fields":{ "keyword":{ "type":"keyword", "ignore_above":256 } } } } } } } }

Any thing to check for why this won’t create a type geo_point ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
honzakralcommented, Jun 26, 2019

@appli-intramuros unfortunately that is not an option, we would have to check before any write operation which would make it prohibitively expensive.

What i can recommend is to disable automatic index creation in elasticsearch by setting action.auto_create_index to false and then attempt to write to a non existent index will fail, thus preventing nasty surprises.

Hope this helps!

1reaction
MariusMezcommented, Feb 14, 2020
class User(DocType):

    location = GeoPoint()
    session_id = Text()

    class Meta:
        index = 'searching_users'
        dynamic = MetaField('strict')`

I have this class definition, but when I create a user like

user = User()
user.session_id = sid
user.location = [lat, lon]
user.save()`

I am getting

{ "searching_users":{ "mappings":{ "doc":{ "properties":{ "location":{ "type":"long" }, "session_id":{ "type":"text", "fields":{ "keyword":{ "type":"keyword", "ignore_above":256 } } } } } } } }

Any thing to check for why this won’t create a type geo_point ?

As browsing this issue, I saw a mistake according to the Elastic documentation in this block of code:

user = User()
user.session_id = sid
user.location = [lat, lon]
user.save()

The correct array setting according to https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-point.html for location is : user.location = [lon, lat]

–> Geo-point expressed as an array with the format: [ lon, lat]

My 2 cents

Read more comments on GitHub >

github_iconTop Results From Across the Web

Survey 123 Geopoint not appearing as location in map viewer
I have created a survey form with survey 123 connect which for one asks the user to supply the location of the project...
Read more >
Geopoints—ArcGIS Survey123 | Documentation
You can add multiple geopoint, geotrace, or geoshape questions to a survey ... When capturing responses using a map, not all features of...
Read more >
node.js - Mapping geopoint doesn't work in ElasticSearch
I add callback for putMapping method and I receive an error. [illegal_argument_exception] Types cannot be provided in put mapping requests, ...
Read more >
Geo-point fields in nested mappings not accessible in Maps
My index has a nested definition that includes a property of type geo-point. I can see it in Discover but it is not...
Read more >
Geographic point vector - MATLAB - MathWorks
If structArray contains the field Lat , and does not contain a field ... Dynamic properties are new features that are added to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found