OhadR
OhadR

Reputation: 8859

elasticsearch: DISJOINT query relation not supported for Field

I have created the simplest index in ES v7.10:

it maps mylocation field into geo_point (not geo_shape):

PUT /myindex
{
    "mappings": {
        "dynamic": "false",
        "properties": {
            "mylocation": {
                "type": "geo_point"
            }
        }
    }
}

then I pushed some data inside. I've omitted this to shorten the question...

When I query the below, all works fine:

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "geo_shape": {
          "mylocation": {
            "shape": {
              "type": "polygon",
              "coordinates": [[ [ 13.0, 53.0 ], [ 0.0, 1.0 ], [ 0.0, 0.0 ],   [ 13.0, 53.0 ] ]]
            },
            "relation": "intersects"
          }
        }
      }
    }
  }
}

when I replace the intersects with disjoint, I get the error:

DISJOINT query relation not supported for Field [mylocation].

In elastic docs (for the relevant version, 7), it is mentioned that "Geoshape query filter documents indexed using the geo_shape or geo_point type" (and I am using the geo_point). Down the same page, it is written the "disjoint" is supported!

What am I missing? Why do I get the error?

Upvotes: 0

Views: 245

Answers (1)

OhadR
OhadR

Reputation: 8859

No idea how I have missed it, but in v7.10 docs (link in the question) they write in the next paragraph:

When searching a field of type geo_point there is a single supported spatial relation operator:

INTERSECTS - (default) Return all documents whose geo_point field intersects the query geometry.

In v7.17 they do not have this limitation anymore...

enter image description here

Upvotes: 0

Related Questions