我創建了以下索引
PUT /proximity_example_1
{
"mappings":{
"properties":{
"doc_id": {
"type": "text"
},
"test_name":{
"type": "text"
}
}
}
}
然后索引一個檔案
POST proximity_example_2/_doc
{
"doc_id": "id1",
"test_name": "test proximity here"
}
然后用proximity 0查詢,如下
GET proximity_example_2/_search
{
"query": {
"match_phrase": {
"test_name": {
"query": "proximity test",
"slop": 0.0
}
}
}
}
但是我沒有得到任何結果,然后我用鄰近 1進行搜索,這一次我也沒有得到任何檔案。但是當我搜索接近度大于 1時,我得到了結果。
GET proximity_example_2/_search
{
"query": {
"match_phrase": {
"test_name": {
"query": "proximity test",
"slop": 2.0
}
}
}
}
GET proximity_example_2/_search
{
"query": {
"match_phrase": {
"test_name": {
"query": "proximity test",
"slop": 3.0
}
}
}
}
那么這是否意味著在彈性搜索中,當我們以接近 1或0的搜索詞順序進行搜索時很重要?
謝謝...
uj5u.com熱心網友回復:
值為 0 的斜率與普通短語搜索一樣好(非常嚴格,搜索詞在 Elasticsearch 中的順序應該完全相同),當你增加斜率時,這種限制性會降低,你會得到更多的搜索結果,但要注意增加到高數字將破壞短語搜索的目的,您將獲得不相關的結果。
你可以閱讀這篇文章和這篇詳細的博客文章,解釋它是如何在內部作業的
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/513926.html
標籤:弹性搜索
