Skip to content

[BUG] case_insensitive wildcard query didn't return expected result #15855

@HUSTERGS

Description

@HUSTERGS

Describe the bug

When perform wildcard query on wildcard field with case_insensitive set to true, the expected doc didn't occur.

Related component

Search

To Reproduce

  1. Create a simple index contains wildcard field

    PUT case_test
    {
        "mappings": {
            "properties": {
                "wildcard": {
                    "type": "wildcard"
                }
            }
        }
    }
    
  2. Bulk insert documents contains capital letters

    PUT _bulk?refresh=true
    {"index": {"_index": "case_test"}}
    {"wildcard": "TtAa"}
    {"index": {"_index": "case_test"}}
    {"wildcard": "ttaa"}
    {"index": {"_index": "case_test"}}
    {"wildcard": "TTAA"}
    
  3. Search on wildcard field with case_insensitive set to true and false respectly
    case sensitive:

    POST case_test/_search
    {
        "query": {
            "term": {
                "wildcard": {
                    "value": "TtAa",
                    "case_insensitive": false
                }
            }
        }
    }
    

    case insensitive:

    POST case_test/_search
    {
        "query": {
            "term": {
                "wildcard": {
                    "value": "TtAa",
                    "case_insensitive": true
                }
            }
        }
    }
    
  4. Check result

Expected behavior

case insensitive query should return all three documents, instead of TtAa alone

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

No one assigned

    Labels

    SearchSearch query, autocomplete ...etcbugSomething isn't working

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions