-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Search:Query CapabilitiesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
An escaped backslash directly in front of the wildcard operator * is not correctly handled.
Related component
Search:Query Capabilities
To Reproduce
- Create an index with a wildcard field:
curl -X PUT "http://localhost/my-index" -H 'Content-Type: application/json' -d'
{
"mappings": {
"properties": {
"wildcard_field": {
"type": "wildcard"
}
}
}
}
'- Insert a document containing a backslash:
curl -X POST "http://localhost/my-index/_doc/1" -H 'Content-Type: application/json' -d'
{
"wildcard_field": "some\\string"
}
'- Query the document:
This query correctly returns the document:
curl -X GET "http://localhost/my-index/search" -H 'Content-Type: application/json' -d'
{
"query": {
"wildcard": {
"wildcard_field": {
"value": "*some\\\\str*"
}
}
}
}
'But this query returns nothing (even tough it should return the same document):
curl -X GET "http://localhost/my-index/search" -H 'Content-Type: application/json' -d'
{
"query": {
"wildcard": {
"wildcard_field": {
"value": "*some\\\\*"
}
}
}
}
'Expected behavior
An escaped backslash before the operator * in a wildcard query must be treated as the literal character \.
Additional Details
Plugins
None
Screenshots
None
Host/Environment (please complete the following information):
- OS: Docker image (Host: Linux Ubuntu 24)
- Version
docker.io/opensearchproject/opensearch:3.2.0anddocker.io/opensearchproject/opensearch:3.3.0
Additional context
None
Metadata
Metadata
Assignees
Labels
Search:Query CapabilitiesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Type
Projects
Status
✅ Done