opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.28k stars 1.71k forks source link

[BUG] wildcard query returns nothing incorrectly when the pattern value contains capital letter #14712

Open LantaoJin opened 1 month ago

LantaoJin commented 1 month ago

Describe the bug

This search query works

GET opensearch_dashboards_sample_data_ecommerce/_search
{
  "from": 0,
  "size": 200,
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "must": [
              {
                "wildcard": {
                  "manufacturer": {
                    "value": "tigress*",
                    "boost": 1
                  }
                }
              }
            ],
            "boost": 1
          }
        }
      ],
      "boost": 1
    }
  },
  "_source": {
    "includes": [
      "manufacturer"
    ],
    "excludes": []
  }
}

But if we change the value to Tigress* (even the real text is Tigress), it return nothing:

GET opensearch_dashboards_sample_data_ecommerce/_search
{
  "from": 0,
  "size": 200,
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "must": [
              {
                "wildcard": {
                  "manufacturer": {
                    "value": "Tigress*",
                    "boost": 1
                  }
                }
              }
            ],
            "boost": 1
          }
        }
      ],
      "boost": 1
    }
  },
  "_source": {
    "includes": [
      "manufacturer"
    ],
    "excludes": []
  }
}

Related component

Search

To Reproduce

  1. Go to playground dev tool
  2. Try above two queries.

Expected behavior

Return matched docs.

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):

Additional context Add any other context about the problem here.

dblock commented 1 month ago

Want to try to write a (failing) YAML REST test?

https://github.com/opensearch-project/OpenSearch/blob/main/TESTING.md#testing-the-rest-layer

kkewwei commented 1 month ago

@LantaoJin can you describe manufacturer field type?