Skip to content

Query String Query with quote_field_suffix not using the quote_field_suffix field to search #29324

@sherry-ger

Description

@sherry-ger

Elasticsearch version
6.2.3

Plugins installed: []
X-Pack

JVM version (java -version):
1.8.0_162

Description of the problem including expected versus actual behavior:

Query string query with quote_field_suffix not using the correct field for search. Simple query string query seems to work correctly. Also, this works fine in version 5.6 and 6.0 alpha 2

Steps to reproduce:

PUT testindex
{
  "settings": {
    "analysis": {
      "analyzer": {
        "english_exact": {
          "tokenizer": "standard",
          "filter": [
            "lowercase"
          ]
        }
      }
    },
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "type": {
      "properties": {
        "body": {
          "type": "text",
          "analyzer": "english",
          "fields": {
            "exact": {
              "type": "text",
              "analyzer": "english_exact"
            }
          }
        }
      }
    }
  }
}

PUT testindex/type/1
{
  "body": "Ski resort"
}

PUT testindex/type/2
{
  "body": "A pair of skis"
}

PUT testindex/type/3
{
  "body": "ski boots"
}

POST testindex/_refresh

GET testindex/_search                               <-- works fine 
{
  "query": {
    "simple_query_string": {
      "fields": [ "body" ],
      "quote_field_suffix": ".exact",
      "query": "\"ski boot\""
    }
  }
}

GET testindex/_search
{
  "query": {
    "query_string": {
      "fields": [ "body" ],
      "quote_field_suffix": ".exact",
      "query": "\"ski boot\""
    }
  }
}

GET testindex/_validate/query?rewrite 
{
  "query": {
    "query_string": {
      "fields": [ "body" ],
      "quote_field_suffix": ".exact",
      "query": "\"ski boot\""
    }
  }
}

The result of the rewrite seems to drop the exact multi-field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions