Ingest processor to set array of geo_points

I'm trying to create an array of geo_points from a document that has 2 different sets of geo_points. I want to combine these two fields into one field that I can visualize on a map. My locations in dest/source_lookup.Location are lat, lon and the array of geo points needs to be lon, lat (which is why I do split and append like I do). My processors look like:

 {
        "split": {
          "field": "source_lookup.Location",
          "separator": ",",
          "target_field": "src_loc",
          "ignore_missing": true
        }
      },
      {
        "split": {
          "field": "dest_lookup.Location",
          "separator": ",",
          "target_field": "dest_loc",
          "ignore_missing": true
        }
      },
      {
        "convert": {
          "field": "dest_loc",
          "type": "float",
          "ignore_missing": true
        }
      },
      {
        "convert": {
          "field": "src_loc",
          "type": "float",
          "ignore_missing": true
        }
      },
      {
        "script": {
          "if": "ctx.containsKey('src_loc')&&ctx.containsKey('dest_loc')",
          "lang": "painless",
          "source": "ArrayList y = [[ctx.src_loc[1],ctx.src_loc[0]],[ctx.dest_loc[1],ctx.dest_loc[0]]]; ctx.Locations = y"
        }
      }

This results in the following:

         "Locations" : [
            [-122.08555, 37.42259],
            [-122.08433, 37.42267]
          ],
          "source" : {
            "address" : "192.168.1.98"
          },
          "source_lookup" : {
            "Location" : "37.42259, -122.08555"
          }
          "src_loc" : [
            37.42259,
            -122.08555
          ],
          "dest_loc" : [
            37.42267,
            -122.08433
          ],
          "dest_lookup" : {
            "Location" : "37.42267, -122.08433"
          }

But I get error:

"cause" : {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse field [Locations] of type [geo_point]",
        "caused_by" : {
          "type" : "parse_exception",
          "reason" : "latitude must be a number"
        }
      }

What can I do?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.