1
我試圖用通配符和_all搜索文檔。但是似乎沒有可能在_all上使用通配符獲得提升結果?Elasticsearch增強與Wildcardsearch在_all
MappingRequest:
"theboostingclass": {
"properties": {
"Important": {
"boost": 2.0,
"type": "string"
},
"LessImportant": {
"type": "string"
},
"Garbage": {
"type": "string"
}
}
}
}
索引:
{
"index" :
{
"_index":"boosting",
"_type":"theboostingclass"
}
}
{
"Important":"bomb",
"LessImportant":"kruka",
"Garbage":"kalkon"
}
{
"index" :
{
"_index":"boosting",
"_type":"theboostingclass"
}
}
{
"Important":"kalkon",
"LessImportant":"bomb",
"Garbage":"bomber"
}
{
"index" :
{
"_index":"boosting",
"_type":"theboostingclass"
}
}
{
"Important":"kruka",
"LessImportant":"bomber",
"Garbage":"bomb"
}
查詢
"query": {
"wildcard": {
"_all": {
"value": "*bomb*"
}
}
}
結果returs全部命中以1分和一個看似隨機的順序。這並不是什麼後來的。我希望在「重要」字段中獲得更高的分數。
如果我對所有3個字段進行通配符搜索,得分似乎是正確的。但是我想在_all上使用它。有任何想法嗎?
哇謝謝。至少現在我得分了。不幸的是,我不能讓他得分更高的「重要」領域。我希望在單場比賽中得分高於其他場上的命中。 (我試圖提高它,並降低其他)我一定錯過了什麼..? 編輯:我試圖添加兩個新項目。一個具有重要的精確匹配字段,另一個具有垃圾上完全匹配的字段。這兩個「炸彈」。重要領域的成績比其他成績低,即使其成績稍遜一籌。這怎麼可能? – Evelie
我在猜測,但它看起來有兩個匹配的其他兩個,第一個只有一個。 「轟炸機」也是一場比賽。完全匹配在這個查詢中完全不重要。如果你想提高精確匹配,你將不得不增加另一個參數到你的查詢。 –
是的,它看起來像。但這正是我試圖用提升來解決的問題。因此,即使有兩場比賽,我想在「重要」欄目上的比賽得分更高。 – Evelie