ElasticSearch works strange with the same text

Viewed 37

I use ElasticSearch in a document management project and it works strangely for the same documents.

I have uploaded three documents with the same text, but during the search one document is often lost.

Example:

  • My super long query -> 3 docs
  • My super long quer -> 2 docs
  • My super long que -> 2 docs
  • My super long qu -> 3 docs
  • My super long q -> 2 docs

My body:

query: {
  bool: {
    must: [{
      query_string: {
        query: `*${query}*`,
        default_operator: 'AND',
        fields: ['text'],
        allow_leading_wildcard: true
      }
    }]
  }
}

My mapping:

"text": {
  "type": "text",
  "fields": {
    "keyword": {
      "type": "keyword",
      "ignore_above": 256
    }
  }
}
0 Answers
Related