1
我用彈性具有以下設置:彈性沒有找到語句中的最後一個字的點到底
ES = {
"mappings": {
ES_DOC_TYPE: {
"properties": {
"message": {
"type": "string",
"analyzer": "liza_analyzer",
"include_in_all": False
}
}
}
},
"settings": {
"number_of_shards": 4,
"analysis": {
"tokenizer": {
"liza_tokenizer": {
"type": "pattern",
"pattern": r"(\.)|[\s,\[\]\(\)\"\!\'\?\`\*\;\:\/<>«»\#]+",
"flags": "UNICODE_CASE"
}
},
"analyzer": {
"liza_analyzer": {
"type": "custom",
"tokenizer": "liza_tokenizer",
"filter": ["lowercase"]
}
},
}
}
}
當我試圖找到一個句子'字「你好」你好世界「,Elastic發現它。
當我試圖在'hello'這個句子中找到一個單詞'hello'。 Elastic發現它。
當我嘗試在'hello'這個句子中找到'hello'這個單詞時,Elastic也找到了它。
但是當我試圖在'hello'這個句子中找到'hello'這個詞時。 (最後一點),Elastic沒有找到它。
同時爲最後兩句令牌看起來像
{
"tokens": [{
"token": "hello",
"start_offset": 0,
"end_offset": 5,
"type": "<ALPHANUM>",
"position": 0
}]
}
(它們是相同的)
的問題是:爲什麼它會發生?我該如何解決它?
什麼是您使用的確切查詢? –
'curl -XPUT'localhost:9200/liza_index/.percolator/UNIQ_ID4'-d'{「query」:{「match」:{「regexp」:{「message」:「hello」}}}}''和'curl -XGET'localhost:9200/liza_index/liza_type/_percolate'-d'{「doc」:{「message」:「hello。」}}'' – Shelari