Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_mvt endpoint returns 400 when results are incomplete (shard errors) instead of partial results like _search endpoint #98730

Closed
nreese opened this issue Aug 22, 2023 · 3 comments · Fixed by #98765
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@nreese
Copy link
Contributor

nreese commented Aug 22, 2023

Elasticsearch Version

main

Installed Plugins

none

Java Version

bundled

OS Version

21.6.0 Darwin Kernel Version 21.6.0

Problem Description

_mvt endpoint returns 400 when results are incomplete (shard errors) instead of partial results like _search endpoint

Steps to Reproduce

Run commands to set up data

PUT local1
{}

PUT local1/_mapping
{
  "properties": {
    "value": {
      "type": "keyword"
    },
    "location": {
      "type": "geo_point"
    }
  }
}

PUT local1/_doc/1
{
    "value" : "foo1",
    "location": [0, 0]
}

PUT local2
{}

PUT local2/_mapping
{
  "properties": {
    "value": {
      "type": "keyword"
    },
    "location": {
      "type": "geo_point"
    }
  }
}

PUT local2/_doc/1
{
    "value" : "foo2",
    "location": [1, 1]
}

Run _mvt request

POST /local*/_mvt/location/1/1/1
{
  "buffer": 0,
  "grid_precision": 0,
  "exact_bounds": true,
  "extent": 4096,
  "query": {
    "bool": {
      "filter": [
        {
          "error_query": {
            "indices": [
              {
                "error_type": "exception",
                "message": "local shard failure message 123",
                "name": "local2"
              }
            ]
          }
        }
      ],
      "must": [],
      "must_not": [],
      "should": []
    }
  }
}

Notice how the response returns 400.

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Unsupported vector tile type for field [_shards.failures.0] : java.util.LinkedHashMap"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Unsupported vector tile type for field [_shards.failures.0] : java.util.LinkedHashMap"
  },
  "status": 400
}

The same request to _search endpoint returns partial results. _mvt should mimic this behavior.

POST /local*/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "error_query": {
            "indices": [
              {
                "error_type": "exception",
                "message": "local shard failure message 123",
                "name": "local2"
              }
            ]
          }
        }
      ],
      "must": [],
      "must_not": [],
      "should": []
    }
  }
}
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 2,
    "successful": 1,
    "skipped": 0,
    "failed": 1,
    "failures": [
      {
        "shard": 0,
        "index": "local2",
        "node": "XPQtz28bSLW26Oynf6oUmg",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: [local2][0] local shard failure message 123",
          "index_uuid": "sg-JHdyNRUqszXjYiQTBNQ",
          "index": "local2",
          "caused_by": {
            "type": "runtime_exception",
            "reason": "[local2][0] local shard failure message 123"
          }
        }
      }
    ]
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 0,
    "hits": [
      {
        "_index": "local1",
        "_id": "1",
        "_score": 0,
        "_source": {
          "value": "foo1",
          "location": [
            0,
            0
          ]
        }
      }
    ]
  }
}

Logs (if relevant)

No response

@nreese nreese added >bug needs:triage Requires assignment of a team area label :Analytics/Geo Indexing, search aggregations of geo points and shapes labels Aug 22, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Aug 22, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Aug 22, 2023
@iverase
Copy link
Contributor

iverase commented Aug 22, 2023

This a side effect of #97619. Before we were just ignoring that part of the result, now we are just reporting we cannot handle it. Maybe we need to go back to the old behaviour.

@nreese
Copy link
Contributor Author

nreese commented Aug 22, 2023

This a side effect of #97619. Before we were just ignoring that part of the result, now we are just reporting we cannot handle it. Maybe we need to go back to the old behaviour.

Just checked 8.8 and response from _mvt endpoint is

{
	"meta": [
		{
			"geometry": {
				"type": "Point",
				"coordinates": [
					0,
					0
				]
			},
			"properties": {
				"_shards.failed": 1,
				"_shards.failures.0.index": "local2",
				"_shards.failures.0.node": "-ydL7NYTR-qgITqZrOHRdQ",
				"_shards.failures.0.reason.index": "local2",
				"_shards.failures.0.reason.index_uuid": "aGlYyc6OQ7iTUIp2yJ7uxw",
				"_shards.failures.0.reason.reason": "Field [location] is of unsupported type [keyword] for [geo_shape] query",
				"_shards.failures.0.reason.type": "query_shard_exception",
				"_shards.failures.0.shard": 0,
				"_shards.skipped": 0,
				"_shards.successful": 1,
				"_shards.total": 2,
				"hits.total.relation": "eq",
				"hits.total.value": 1,
				"timed_out": false,
				"took": 56
			}
		}
	],
	"hits": [
		{
			"geometry": {
				"type": "Point",
				"coordinates": [
					0,
					0
				]
			},
			"properties": {
				"_id": "1",
				"_index": "local1"
			}
		}
	]
}

Reverting to this response would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants