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

Lowercase normalizer is used for wildcard queries #28894

Open
dadoonet opened this issue Mar 4, 2018 · 2 comments
Open

Lowercase normalizer is used for wildcard queries #28894

dadoonet opened this issue Mar 4, 2018 · 2 comments
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@dadoonet
Copy link
Member

dadoonet commented Mar 4, 2018

Elasticsearch version (bin/elasticsearch --version): 6.2.2
Description of the problem including expected versus actual behavior:

Say you index a field Aa as a text field with a Lowercase analyzer.
When you search for aa*, it matches. Searching for Aa* does not match which is normal as the wildcard queries are not analyzed.

Say you index a field Aa as a keyword field with a Lowercase normalizer.
When you search for aa*, it matches. Searching for Aa* matches as well although the wildcard queries are not analyzed.

Steps to reproduce:

DELETE test
PUT test
{
  "settings": {
    "analysis": {
      "normalizer": {
        "lowercase_normalizer": {
          "type": "custom",
          "filter": [
            "lowercase"
          ]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "foo": {
          "type": "text",
          "analyzer": "simple", 
          "fields": {
            "keyword": {
              "type": "keyword",
              "normalizer": "lowercase_normalizer"
            }
          }
        }
      }
    }
  }
}
PUT test/doc/1?refresh
{
  "foo": "Bbb Aaa"
}

# Does not match -> OK
GET test/_search
{
  "query": {
    "wildcard": {
      "foo": "Bb*"
    }
  }
}
# Match -> OK
GET test/_search
{
  "query": {
    "wildcard": {
      "foo": "bb*"
    }
  }
}
# Match but should not -> KO
GET test/_search
{
  "query": {
    "wildcard": {
      "foo.keyword": "Bb*"
    }
  }
}
# Match -> OK
GET test/_search
{
  "query": {
    "wildcard": {
      "foo.keyword": "bb*"
    }
  }
}

I spoke with @jpountz who thinks it might be related to https://issues.apache.org/jira/browse/LUCENE-8186

Opening the issue so we can track it.

@dadoonet dadoonet added >bug :Search/Search Search-related issues that do not fall into other categories labels Mar 4, 2018
@javanna
Copy link
Member

javanna commented Mar 6, 2018

cc @elastic/es-search-aggs

@jpountz
Copy link
Contributor

jpountz commented May 28, 2018

Fixed on the Lucene side via https://issues.apache.org/jira/browse/LUCENE-8186 but will need change on the Elasticsearch side as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

No branches or pull requests

4 participants