Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-45399

FTS: geospatial query results order differs for CB and Elastic.

    XMLWordPrintable

Details

    • Untriaged
    • Centos 64-bit
    • 1
    • Unknown

    Description

      Build: 7.0.0-4797

      Create bucket `default`, load attached data (default.json)

      Create the following FTS index:

      {
       "name": "geo-index",
       "type": "fulltext-index",
       "params": {
        "doc_config": {
         "docid_prefix_delim": "",
         "docid_regexp": "",
         "mode": "type_field",
         "type_field": "type"
        },
        "mapping": {
         "default_analyzer": "standard",
         "default_datetime_parser": "dateTimeOptional",
         "default_field": "_all",
         "default_mapping": {
          "dynamic": true,
          "enabled": false
         },
         "default_type": "_default",
         "docvalues_dynamic": true,
         "index_dynamic": true,
         "store_dynamic": false,
         "type_field": "_type",
         "types": {
          "earthquake": {
           "dynamic": true,
           "enabled": true,
           "properties": {
            "geo": {
             "enabled": true,
             "dynamic": false,
             "fields": [
              {
               "docvalues": true,
               "include_in_all": true,
               "index": true,
               "name": "geo",
               "type": "geopoint"
              }
             ]
            }
           }
          }
         }
        },
        "store": {
         "indexType": "scorch",
         "segmentVersion": 15
        }
       },
       "sourceType": "gocbcore",
       "sourceName": "default",
       "sourceUUID": "9f032e7c4538aae118c7ea711df0d6a3",
       "sourceParams": {},
       "planParams": {
        "maxPartitionsPerPIndex": 1024,
        "numReplicas": 0,
        "indexPartitions": 1
       },
       "uuid": "577911ccb2f0b674"
      }
      

      Run the following query:

      {"indexName": "geo-index", "size": 10000000, "from": 0, "explain": false, "query": {"location": {"lon": -64.35, "lat": 19.59}, "distance": "10000km", "field": "geo"}, "fields": [], "ctl": {"consistency": {"level": "", "vectors": {}}, "timeout": 60000}, "sort": [{"by": "geo_distance", "field": "geo", "unit": "km", "location": "de6prwm"}]}
      

      Corresponding ES query:

      {'query': {'match_all': {}}, 'filter': {'geo_distance': {'distance': '10000km', 'geo': {'lat': 19.59, 'lon': -64.35}}}, 'sort': [{'_geo_distance': {'geo': 'de6prwm', 'order': 'asc', 'unit': 'km'}}]}
      

      Difference in results order will be here:

      DIFFERENCE IS IN 632 POSITION
      FTS VAL: earthquake497
      ES  VAL: earthquake806
      DIFFERENCE IS IN 633 POSITION
      FTS VAL: earthquake806
      ES  VAL: earthquake497
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          Problem is reproducible for build 7.0.0-1000

          which is first available CC build

          evgeny.makarenko Evgeny Makarenko (Inactive) added a comment - - edited Problem is reproducible for build 7.0.0-1000 which is first available CC build

          Evgeny Makarenko I can't find documents earthquake806 and earthquake497 in the JSON file you've shared - have you checked if the geo_distance of the 2 documents is the same from the search geo point?

          abhinav Abhinav Dangeti added a comment - Evgeny Makarenko  I can't find documents earthquake806 and earthquake497 in the JSON file you've shared - have you checked if the geo_distance of the 2 documents is the same from the search geo point?

          Using haversine formula fir calculations I found that Couchbase order of results is correct, Elastic order is incorrect.

          Having 3 points:

          point1 {38.828, -122.83}

          point2 {38.8385, -122.8292}

          and destination {19.59, -64.35}

          I found that point1 - destination distance is 5.956081199433075E8 sm,  

          which is shorter than point2 - destination distance: 5.956081207134653E8 sm .

          So, point 1 must be ordered first, point2 must be ordered second.

          That's exactly how results are represented in Couchbase. 

          evgeny.makarenko Evgeny Makarenko (Inactive) added a comment - Using haversine formula fir calculations I found that Couchbase order of results is correct, Elastic order is incorrect. Having 3 points: point1 {38.828, -122.83} point2 {38.8385, -122.8292} and destination {19.59, -64.35} I found that point1 - destination distance is 5.956081199433075E8 sm,   which is shorter than point2 - destination distance: 5.956081207134653E8 sm . So, point 1 must be ordered first, point2 must be ordered second. That's exactly how results are represented in Couchbase. 

          People

            evgeny.makarenko Evgeny Makarenko (Inactive)
            evgeny.makarenko Evgeny Makarenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty