opensearch-project/OpenSearch
在 GitHub 查看[BUG] Exists query fails if object has "search_as_you_type" field
Open
#11,821 建立於 2024年1月9日
Searchbuggood first issue
倉庫指標
- Star
- (8,123 star)
- PR 合併指標
- (平均合併 5天 9小時) (30 天內合併 266 個 PR)
描述
Describe the bug
The "exists" query on an object field will fail when a "search_as_you_type" field is nested under that object. See step to reproduce for an example.
Related component
Search
To Reproduce
Queries:
PUT bug_exists
{
"mappings": {
"properties": {
"user": {
"properties": {
"name": {
"type": "keyword",
"normalizer": "lowercase",
"fields": {
"lookup": {
"type": "search_as_you_type",
"doc_values": false,
"max_shingle_size": 3
}
}
}
}
}
}
}
}
POST bug_exists/_doc
{
"user": {
"name": "foo"
}
}
POST bug_exists/_search
{
"query": {
"exists": {
"field": "user"
}
}
}
Executing search query gives the following error:
{
"error": {
"root_cause": [
{
"type": "unsupported_operation_exception",
"reason": "unsupported_operation_exception: null"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "bug_exists",
"node": "vQR3k_EpTqGwm-tWhNHpJA",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: null",
"index": "bug_exists",
"index_uuid": "2XEpnkKbSL62szsFvLvOtw",
"caused_by": {
"type": "unsupported_operation_exception",
"reason": "unsupported_operation_exception: null"
}
}
}
],
"caused_by": {
"type": "unsupported_operation_exception",
"reason": "unsupported_operation_exception: null"
}
},
"status": 400
}
Expected behavior
The following query should not fail and return the document
POST bug_exists/_search
{
"query": {
"exists": {
"field": "user"
}
}
}
Additional Details
Host/Environment (please complete the following information):
- AWS OpenSearch 2.11
Additional context The same bug in ElasticSearch fixed in 8.0 https://github.com/elastic/elasticsearch/issues/64609