Skip to content

default_field param of QUERY() won't be deployed to Query String Query #32602

@kosho

Description

@kosho

Elasticsearch version (bin/elasticsearch --version): 6.3.2

Plugins installed: []

JVM version (java -version): 1.8.0_181

OS version (uname -a if on a Unix-like system): Darwin Kernel Version 17.7.0

Description of the problem including expected versus actual behavior:

As I am supplying default_field=<field> parameter in the QUERY operand in the WHERE clause, it won't be deployed into query_string query.

Steps to reproduce:

  1. Create a new index with a single document as below:
PUT test/test/1
{
  "tag_line": "You know for search",
  "product": "Elasticsearch"
}
  1. Throw the following query to _xpack/sql/translate endpoint.
POST _xpack/sql/translate
{
  "query": "SELECT * FROM test WHERE QUERY('search', 'default_field=tag_line', 'default_operator=and')"
}
  1. Check if default_field is not shown in the response while default_operator=and is reflected.
{
  "size": 1000,
  "query": {
    "query_string": {
      "query": "search",
      "fields": [],
      "type": "best_fields",
      "default_operator": "and",
      "max_determinized_states": 10000,
      "enable_position_increments": true,
      "fuzziness": "AUTO",
      "fuzzy_prefix_length": 0,
      "fuzzy_max_expansions": 50,
      "phrase_slop": 0,
      "escape": false,
      "auto_generate_synonyms_phrase_query": true,
      "fuzzy_transpositions": true,
      "boost": 1
    }
  },
  "_source": {
    "includes": [
      "product",
      "tag_line"
    ],
    "excludes": []
  },
  "sort": [
    {
      "_doc": {
        "order": "asc"
      }
    }
  ]
}

Provide logs (if relevant):

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions