任何人都可以請告訴我如何可以在elasticsearch中使用多個字段編寫通配符查詢我在這方面搜索了很多,但有人告訴我使用查詢字符串或多個匹配,但在我的情況下問題是查詢字符串不工作我我的代碼下面給出了一個單場通配符查詢,如果任何人都知道這事,請大家分享一些光在這ES中有多個字段的通配符查詢?
"query": {
"wildcard" : { "places_area1.city.raw_wildcard" : last_wildcard_string }
}
UPDATE 映射
"settings": {
"index": {
"analysis": {
"analyzer": {
"synonym_wildcard": {
"tokenizer": "whitespace",
"filter": ["filter_wildcard"]
},
"synonym_term": {
"tokenizer": "keyword",
"filter": ["filter_term"]
},
"simple_wildcard": {
"tokenizer": "whitespace"
}
},
"filter": {
"filter_term": {
"tokenizer": "keyword", // here you have to write this only for tokenizer keyword but not for whitespace
"type": "synonym",
"synonyms_path": "synonyms.txt",
},
"filter_wildcard": {
"type": "synonym",
"synonyms_path": "synonyms.txt",
}
}
}
}
},
mappings : {
places_area1: {
properties:{
area1 : {"type" : "string", "index": "analyzed", "analyzer": "simple_wildcard"},
city : {"type" : "string", "fields": {
"raw": {
"type": "string",
"analyzer": "synonym_term"
},
"raw_wildcard": {
"type": "string",
"analyzer": "synonym_wildcard"
}
} },
}
}
}
}
預先感謝您
什麼是您對字段映射你正在運行查詢?你能告訴我們你想要像樣本文件一樣匹配嗎? – ChintanShah25
hey chintan你能幫我一個忙嗎你知道如何在ES中編寫帶有多個字段的通配符查詢? –