Geo_shape query not working in version 6

Hi,

I have an index with the following mapping.

PUT test
{
  "mappings": {
    "type1": {
      "properties": {
        "geolocation": {
          "type": "geo_shape",
          "precision": "1.0m",
          "points_only": true
        },
        "name": {
          "type": "keyword",
          "store": true,
          "ignore_above": 25
        }
      }
    }
  }
}

The following query works fine in the version 5.5.1:

GET /test/_search
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "name": "testname"
          }
        }
      ],
      "filter": {
        "geo_shape": {
          "geolocation": {
            "shape": {
              "type": "Polygon",
              "coordinates": [
                [
                  [
                    -78,
                    39
                  ],
                  [
                    -86,
                    39
                  ],
                  [
                    -90,
                    32
                  ],
                  [
                    -78,
                    39
                  ]
                ]
              ]
            },
            "relation": "within"
          }
        }
      }
    }
  }
}

Running the query on version 6.2.1 returns 0 count.

Sample document in the index looks like this:

{
	"geolocation": {
            
		"coordinates": [
              "-86.474",
              "35.981"
        ],
        "type": "point"
    },
	"name" : "testname"
}

Is there any reason why the query on the version 6 cluster would return 0 but works fine on the version 5 cluster?

Any help is appreciated.

Thanks.

It appears that the same query works in version 6 when I change the coordinates inside the field to:

{
	"geolocation": {
            
		"coordinates": [
              -86.1234,
              35.5678
        ],
        "type": "point"
    },
	"name" : "testname"
}

Removing the double quotes makes the same query work, wondering why version 5 would allow the query to run with the coordinates not stored as float but as strings.

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