Skip to content

Completion suggester returns mangled documents #34378

@hofrob

Description

@hofrob

Elasticsearch version: docker.elastic.co/elasticsearch/elasticsearch:6.3.2

Kibana: docker.elastic.co/kibana/kibana:6.3.2

Plugins installed: none

Description of the problem including expected versus actual behavior:

  1. create index for completion suggest
  2. Put 3 documents with a custom ID in the index
  3. search the index for a word contained in 2 of the documents
  4. get 2 mangled results (field text does not belong to source)

Steps to reproduce:

This is terribly hard to reproduce. Just anonymising the data but still trying to reproduce this bug was almost impossible. If you change one little thing, it's not reproducable. So maybe this helps in finding the cause of this. If we are doing something wrong, please tell us, we're on our wits end.

Removing the ID works in this specific case, but it does not solve the issue completely. The bug would still pop up in our system with different documents.

copy paste from kibana:

DELETE test_suggest

PUT test_suggest
{
  "mappings": {
    "something": {
      "properties": {
        "what_suggest":   {
          "type":             "completion"
        }
      }
    }
  }
}

PUT test_suggest/something/profile_284
{
  "id":             "profile_284",
  "term":           "ab abcdefghij klmnopq",
  "where_suggest":  [],
  "street_suggest": [],
  "what_suggest":   [
    {
      "input":  "abcdefghij klmnopq",
      "weight": 3
    }
  ],
  "value":          "ab abcdefghij klmnopq"
}

PUT test_suggest/something/profile_285
{
  "id":             "profile_285",
  "term":           "dr zyxwvu wrong abcdef",
  "where_suggest":  [],
  "street_suggest": [],
  "what_suggest":   [
    {
      "input":  "zyxwvu wrong",
      "weight": 3
    }
  ],
  "value":          "dr zyxwvu wrong abcdef"
}


PUT test_suggest/something/profile_286
{
  "id":             "profile_286",
  "term":           "abcd efg hi zyxwvu abcdefgh",
  "where_suggest":  [],
  "street_suggest": [],
  "what_suggest":   [
    {
      "input":  "zyxwvu abcdefgh",
      "weight": 3
    }
  ],
  "value":          "abcd efg hi zyxwvu abcdefgh"
}


POST test_suggest/something/_search
{
  "size":    20,
  "suggest": {
    "test_suggest": {
      "prefix":     "zyxwvu",
      "completion": {
        "field": "what_suggest",
        "size":  10,
        "fuzzy": {
          "fuzziness": 0
        }
      }
    }
  }
}

result of the search:

The document in _source does not match the value in the field text

{
  "took": 4,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": 0,
    "hits": []
  },
  "suggest": {
    "test_suggest": [
      {
        "text": "zyxwvu",
        "offset": 0,
        "length": 6,
        "options": [
          {
            "text": "zyxwvu abcdefgh",
            "_index": "test_suggest",
            "_type": "something",
            "_id": "profile_285",
            "_score": 18,
            "_source": {
              "id": "profile_285",
              "term": "dr zyxwvu wrong abcdef",
              "where_suggest": [],
              "street_suggest": [],
              "what_suggest": [
                {
                  "input": "zyxwvu wrong",
                  "weight": 3
                }
              ],
              "value": "dr zyxwvu wrong abcdef"
            }
          },
          {
            "text": "zyxwvu wrong",
            "_index": "test_suggest",
            "_type": "something",
            "_id": "profile_286",
            "_score": 18,
            "_source": {
              "id": "profile_286",
              "term": "abcd efg hi zyxwvu abcdefgh",
              "where_suggest": [],
              "street_suggest": [],
              "what_suggest": [
                {
                  "input": "zyxwvu abcdefgh",
                  "weight": 3
                }
              ],
              "value": "abcd efg hi zyxwvu abcdefgh"
            }
          }
        ]
      }
    ]
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions