-
Couldn't load subscription status.
- Fork 2.3k
Closed
Labels
SearchSearch query, autocomplete ...etcSearch query, autocomplete ...etcbugSomething isn't workingSomething isn't working
Description
Describe the bug
When use wildcard query on wildcard field, raw * (and maybe include raw ?), is not handled correctly, while the same wildcard query can work well on keyword field. Possibly the escape logic is not implemented in opensearch/index/mapper/WildcardFieldMapper.java.
Related component
Search
To Reproduce
- Create a simple index containing both wildcard and keyword type
PUT escape_index { "mappings": { "properties": { "wild": { "type": "wildcard", "fields": { "keyword": { "type": "keyword" } } } } } } - Insert data with raw
*POST escape_index/_doc { "wild": "* test *" } - search on both field with the same wildcard query
Search on KEYWORD type:Result:GET escape_index/_search { "query": { "wildcard": { "wild.keyword": { "value": "\\**" } } } }Search on WILDCARD type{ "took": 2, "timed_out": false, "_shards": { "total": 2, "successful": 2, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 1, "relation": "eq" }, "max_score": 1, "hits": [ { "_index": "escape_index", "_id": "xMi6opEB80UGmJnvgJSB", "_score": 1, "_source": { "wild": "* test *" } } ] } }Result:GET escape_index/_search { "query": { "wildcard": { "wild": { "value": "\\**" } } } }{ "took": 1, "timed_out": false, "_shards": { "total": 2, "successful": 2, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 0, "relation": "eq" }, "max_score": null, "hits": [] } }
Expected behavior
get the correct results when wildcard query contains raw * and ? characters
Additional Details
No response
Metadata
Metadata
Assignees
Labels
SearchSearch query, autocomplete ...etcSearch query, autocomplete ...etcbugSomething isn't workingSomething isn't working
Type
Projects
Status
✅ Done