ElasticSearch Highlight Behavior - PullRequest
       23

ElasticSearch Highlight Behavior

0 голосов
/ 29 сентября 2019

Я использую подсветку ElasticSearch, и поведение сбивает с толку.

Ниже приведен мой документ, который проиндексирован:

POST clients_with_lemma_policy_document_type_en-us/doc/D1OoeG0B0rPisNgfCVyL
    {
  "query": {
    "bool": {
      "should": [
        {
          "query_string": {
            "query": """(NOT(isLemmatisationEnabled : 1) AND "knives") OR ((isLemmatisationEnabled : 1) AND "knife")"""
          }
        }
      ],
      "minimum_should_match": 1
    }
  },
  "phraseConfigVersion": 0,
  "mode": "BLACKLISTING",
  "metadataInformation": {
    "category": "offensive"
  },
  "phrases": [
    "knives"
  ],
  "lemmas": [
    "knife"
  ]
}

И это мой поиск:

GET clients_with_lemma_policy_document_type_en-us/_search/
{
  "query": {
    "percolate": {
      "field": "query",
      "document": {
        "mainText": [
          "I have too many knives!!! knife."
        ],
        "subText": "I have too many knives knife kill."
      }
    }
  },
  "highlight": {
    "number_of_fragments": 0,
    "fields": {
      "*": {
        "pre_tags": [
          "<em>"
        ],
        "post_tags": [
          "</em>"
        ]
      }
    }
  },
  "size": 10000
}

Результат:

{
"took": 12,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.2876821,
"hits": [
{
"_index": "clients_with_lemma_policy_document_type_en-us",
"_type": "doc",
"_id": "D1OoeG0B0rPisNgfCVyL",
"_score": 0.2876821,
"_source": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": """("knives") OR ((isLemmatisationEnabled : 1) AND "knife") """
}
}
],
"minimum_should_match": 1
}
},
"phraseConfigVersion": 0,
"mode": "BLACKLISTING",
"metadataInformation": {
"category": "offensive"
},
"phrases": [
"knives"
],
"lemmas": [
"knife"
]
},
"fields": {
"_percolator_document_slot": [
0
]
},
"highlight": {
"mainText": [
"I have too many knives!!! knife."
],
"subText": [
"I have too many knives knife kill."
]
}
}
]
}
}

Почему подсвечивается «нож», хотя входной документ не содержит флаг isLemmatisationEnabled?

...