我有一些名為“FullTitleFts”的物件欄位。它里面有“文本”欄位。此查詢作業正常(并回傳一些條目):
GET index/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"fullTitleFts.text": "Ivan"
}
}
]
}
}
}
但是這個查詢什么也不回傳:
GET index/_search
{
"query": {
"bool": {
"should": [
{
"multi_match": {
"query": "Ivan",
"fields": [
"fullTitleFts.text"
]
}
}
]
}
}
}
欄位映射:
"fullTitleFts": {
"copy_to": [
"text"
],
"type": "keyword",
"fields": {
"text": {
"analyzer": "analyzer",
"term_vector": "with_positions_offsets_payloads",
"type": "text"
}
}
}
"analyzer": {
"filter": [
"lowercase",
"hypocorisms",
"protect_kw"
],
"char_filter": [
"replace_char_filter",
"e_char_filter"
],
"expand": "true",
"type": "custom",
"tokenizer": "standard"
}
e_char_filter用于將西里爾字符“ё”替換為“е”,replace_char_filter用于從文本中洗掉“?”。Protect_kw是一些俄羅斯工會的關鍵字標記。hypocorisms是同義詞圖,用于制作另一種形式的名稱。
分析器輸出示例:
GET index/_analyze
{
"analyzer": "analyzer",
"text": "Алёна?"
}
{
"tokens" : [
{
"token" : "аленка",
"start_offset" : 0,
"end_offset" : 5,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "аленушка",
"start_offset" : 0,
"end_offset" : 5,
"type" : "SYNONYM",
"position" : 0
},
{
"token" : "алена",
"start_offset" : 0,
"end_offset" : 5,
"type" : "<ALPHANUM>",
"position" : 0
}
]
}
I've also found this question. And it seems that the answer didn't really work - author had to add "include_in_root" option in mapping. So i wondering if multi match supports nested or object fields at all. I am also can't find anything about it in docs.
uj5u.com熱心網友回復:
由于您提供了索引映射,您的欄位被定義為多欄位,而不是嵌套或物件欄位。所以兩者都match應該multi_match在不提供的情況下作業path。您可以fullTitleFts.text在需要搜索文本型別和fullTitleFts需要搜索關鍵字型別時使用欄位名稱。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/447872.html
上一篇:Elasticsearch:查詢以根據欄位值和回傳計數過濾掉特定檔案
下一篇:從日期時間列中選擇多天的時間視窗
