Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LantaoJin opened this issue Jul 11, 2024 · 3 comments
Labels
bug Something isn't working Search Search query, autocomplete ...etc

Comments

@LantaoJin
Copy link
Member

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

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@dblock
Copy link
Member

dblock commented Jul 11, 2024

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
Copy link
Contributor

kkewwei commented Jul 13, 2024

@LantaoJin can you describe manufacturer field type?

@mch2 mch2 removed the untriaged label Jul 24, 2024
@bugmakerrrrrr
Copy link
Contributor

You can use the case_insensitive parameter

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Search Search query, autocomplete ...etc
Projects
Status: 🆕 New
Development

No branches or pull requests

5 participants