Skip to content

Conversation

Leihb
Copy link

@Leihb Leihb commented Jan 11, 2019

use is_active = "is_active,bool" to map a mysql tinyint to es boolean,
use lat = "location,geo_point.lat" lon = "location,geo_point.lon" to create a es geo_point

@siddontang
Copy link
Collaborator

Thanks @Leihb

Sorry for the late response, I will review it this week.

fieldTypeGeopointLat = "geo_point.lat"
fieldTypeGeopointLon = "geo_point.lon"

fieldTypeBoolean = "bool"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this type associated with geo type?
If not, I suggest using another PR to support it.

if mysql == c.Name {
mapped = true
req.Data[elastic] = r.getFieldValue(&c, fieldType, values[i])
if fieldType == fieldTypeGeopointLat {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not handing this in getFieldValue?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because getFieldValue has no access to already read field values and would overwrite the first part of the geo point.
for long and lat it would do:

  1. getFieldValue for longitude. returns map with { long: n }
  2. getFieldValue for latitude. return map with { lat: n }
  3. writing data would require to merge the both results, because we can't access the already processed data (or next)

@derN3rd
Copy link

derN3rd commented Jan 22, 2019

@Leihb I tried out your changes and it looks like your changes don't work.
When I debug the request that is sent to elasticsearch, it shows that only a single float (either lat or lon) is set on the geopoint field, which then fails for obvious reasons.
I am trying to debug now

EDIT: had it linked wrong. works like it should, thanks @Leihb

@Leihb Leihb closed this Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants