[英]Elasticsearch: Using of field analyser in query_string
我只想使用每個字段的分析器來做一個query_string,而不是所有字段的一個
我是否需要指定所有字段,例如
GET /_search
{
"query": {
"query_string" : {
"fields" : ["content", "name", ...],
"query" : "this AND that"
}
}
}
有解決方案嗎?
謝謝
首先, _all
從6.0開始不推薦使用。 資料來源: https : //www.elastic.co/guide/en/elasticsearch/reference/current/mapping-all-field.html
文章建議創建一個自定義字段,可以按您想要的方式對其進行分析和搜索。 樣品
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"first_name": {
"type": "text",
"copy_to": "fake_all"
},
"last_name": {
"type": "text",
"copy_to": "fake_all"
},
"fake_all": {
// Here you can define analyzer you want
// And use this field four your query_string query
"type": "text"
}
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.