Skip to content

[BUG] Error when use both wildcard + aggregation #19319

@xinyual

Description

@xinyual

Describe the bug

The cluster throw an error when I use both wlidcard + aggregation

Related component

Search:Aggregations

To Reproduce

Use OS 3.2.

  1. Create mapping and ingest data
PUT hits
{
    "mappings": {
            "properties": {
                "URL": {
                    "type": "keyword"
                }
            }
        }
}
POST hits/_doc
{
   "URL": "http:\/\/google1.ru\/news\/post-41494,96205&bt=7&bn=1&bodystyle"
}
POST hits/_doc
{
   "URL": "http:\/\/google2.ru\/news\/post-41494,96205&bt=7&bn=1&bodystyle"
}

  1. Run query
POST hits/_search
{
  "from": 0,
  "size": 0,
  "timeout": "1m",
  "query": {
    "wildcard": {
      "URL": {
        "wildcard": "*google*",
        "case_insensitive": true,
        "boost": 1.0
      }
    }
  },
  "_source": {
    "includes": [
      "URL"
    ],
    "excludes": []
  },
  "sort": [
    {
      "_doc": {
        "order": "asc"
      }
    }
  ],
  "aggregations": {
    "count()": {
      "value_count": {
        "field": "_index"
      }
    }
  }
}

And get error

{
    "error": {
        "root_cause": [
            {
                "type": "array_index_out_of_bounds_exception",
                "reason": "Index 10 out of bounds for length 10"
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": "hits6",
                "node": "CR0Xi69OQi-jZ6quT_q92g",
                "reason": {
                    "type": "array_index_out_of_bounds_exception",
                    "reason": "Index 10 out of bounds for length 10",
                    "suppressed": [
                        {
                            "type": "array_index_out_of_bounds_exception",
                            "reason": "Index -6 out of bounds for length 9"
                        }
                    ]
                }
            }
        ],
        "caused_by": {
            "type": "array_index_out_of_bounds_exception",
            "reason": "Index 10 out of bounds for length 10",
            "caused_by": {
                "type": "array_index_out_of_bounds_exception",
                "reason": "Index 10 out of bounds for length 10",
                "suppressed": [
                    {
                        "type": "array_index_out_of_bounds_exception",
                        "reason": "Index -6 out of bounds for length 9"
                    }
                ]
            }
        }
    },
    "status": 500
}

Looks an error in lucene

Expected behavior

Return correct result.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

🆕 New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions