Uploaded image for project: 'Usergrid (Retired)'
  1. Usergrid (Retired)
  2. USERGRID-1126

Documents not getting index when JSON contains latitude or longitude fields with empty string values

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.0
    • None
    • None
    • Usergrid 32

    Description

      Exception seen:

      2015-11-21 21:40:37,249 [Usergrid-SQS-Pool-88] ERROR org.apache.usergrid.corepersistence.asyncevents.AmazonAsyncEventService- Failed to index message: 7435e8a3-9f4c-4a08-a833-307698c45cbd
      java.lang.RuntimeException: Error during processing of bulk index operations one of the responses failed.
      MapperParsingException[failed to parse]; nested: NumberFormatException[empty String];
      

      Inside the entities, there are latitude and longitude fields which contain empty strings. These are mapped in Usergrid/Elasticsearch as geo_point types which are expected to be numbers or non-empty strings that can parse to coordiantes. This is causing the document to get rejected upon indexing. See the following for ensuring we are pre-validating so documents don't get rejected: https://www.elastic.co/guide/en/elasticsearch/reference/1.7/mapping-geo-point-type.html

      Needs to be fixed here to not add the lat and lon properties if the values are null or empty strings (non empty strings index without a problem).
      org/apache/usergrid/persistence/index/impl/EntityMappingParser.java:133

      A temporary workaround is just to assign a number value for these fields, or just don't include them at all in the JSON request.

      Current:

      "geographicCoordinates": {
                    "latitude": "",
                    "longitude": ""
                  }
      

      Example workaround:

      "geographicCoordinates": {
                    "latitude": 1,
                    "longitude": 1
                  }
      

      Attachments

        Activity

          People

            mrusso Michael Russo
            mrusso Michael Russo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: