Skip to content

Wrong result of "simple_query_search" with prefix query. #28204

@lbrzekowski

Description

@lbrzekowski

Elasticsearch version
6.1.0

Plugins installed: []

JVM version (java -version):
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

OS version:
Ubuntu 17.10 with 4.13.0-21-generic

Description of the problem including expected versus actual behavior:
When index's mapping includes text and date properties, result of simple_query_search, which includes asterisk for prefix query,
returns no documents.
When there's no date properties on index's mappping, query works fine.
The same query works fine on 5.6 version.

Steps to reproduce:

  1. Create index "tests" with text and date properties.
curl -XPUT http://localhost:9200/tests -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "mappings": {
    "test": {
      "properties": {
        "date": {
          "type": "date"
        },
        "name": {
          "type": "text",
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}'
  1. Put some data
curl -XPUT http://localhost:9200/tests/test/1 -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
{
  "date": "2018-01-12",
  "name": "test1"
}'
  1. Try to search with simple_query_search and asterisk.
curl -XPOST http://localhost:9200/tests/_search -H 'Content-Type: application/json' -H 'Accept: application/json' -d '
{
  "query": {
    "simple_query_string": {
      "query": "te*"
    }
  }
}'

Received result: no documents found
Expected result: document with id 1 found

Provide logs (if relevant):
there's no errors on logs

Metadata

Metadata

Assignees

Labels

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

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions