-
Couldn't load subscription status.
- Fork 2.3k
Description
Describe the bug
When trying to incorporate the new wildcard field type into some existing index/query structures, I am encountering an error when using a wildcard in a fields query block.
"reason": "failed to create query: Index 0 out of bounds for length 0",
It seems to be related to the presence of multiple top level properties (my existing data has info split between doc.* fields and metadata.* fields, and when I create a test index with only doc.* fields it seems to work).
Related component
Search
To Reproduce
- Create an index with more than one subproperty (possibly the incorrect terminology)
PUT test_index
{
"mappings": {
"dynamic": "strict",
"properties": {
"doc": {
"properties": {
"summary": {
"type": "wildcard"
}
}
},
"metadata": {
"properties": {
"status": {
"type": "long"
}
}
}
}
}
}
- Make a query against the index with wildcard in the fields block
GET test_index/_search
{
"from": 0,
"query": {
"query_string": {
"analyze_wildcard": true,
"fields": [
"doc.*"
],
"query": "*foo*"
}
}
}
- Receive error response
{
"error": {
"root_cause": [
{
"type": "query_shard_exception",
"reason": "failed to create query: Index 0 out of bounds for length 0",
"index": "test_index",
"index_uuid": "jkSC-uIXStyOy2db_3ZLtA"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test_index",
"node": "GTGj9ZMiT-WUbQTyOtkTdw",
"reason": {
"type": "query_shard_exception",
"reason": "failed to create query: Index 0 out of bounds for length 0",
"index": "test_index",
"index_uuid": "jkSC-uIXStyOy2db_3ZLtA",
"caused_by": {
"type": "string_index_out_of_bounds_exception",
"reason": "Index 0 out of bounds for length 0"
}
}
}
]
},
"status": 400
}
Expected behavior
If the type is not a wildcard, such as a keyword, the query completes with no errors. I would expect either an informative error if this query structure is incompatible with wildcards for some reason, or (ideally) for the query to just work like it does with non-wildcard fields.
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):
Querying OpenSearch 2.15 and 2.16 running as a docker container from an opensearch-dashboards 2.15 interface also running via Docker.
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status