2014-09-30 32 views
0

首先,我跟着彈性搜索教程一起,位於here。我試圖用多個查詢字符串執行搜索。彈性搜索,匹配一個字符串上的多個術語

我的索引有幾個字段,但我感興趣的是「路徑」。

我知道我至少有這個路徑

path: "ops/TopRelation/...." 

在我的索引。我已經證實了這一點。

那麼這個查詢怎麼回事呢?

{ 
    "query":{ 
     "match":{ 
      "path":{ 
       "query": "ops toprelation", 
       "operator": "and" 
      } 
     } 
    } 
} 

但是這個查詢返回我期望的結果。

{ 
    "query": { 
     "bool": { 
      "must": [ 
       { "match": { "path": "ops" }}, 
       { "match": { "path": "toprelation" }} 
      ] 
     } 
    } 
} 

我認爲頂級查詢基本上是一個使用底部查詢內部?事實上,本教程中的例子似乎表明this

Because the match query has to look for two terms — ["brown","dog"] — internally it 
has to execute two term queries and combine their individual results into the overall 
result. To do this, it wraps the two term queries in a bool query, which we will 
examine in detail in Combining queries below. 

回答

0

如果在「運算符」中使用「或」而不是「和」,它會返回任何結果嗎?

請您分享該指數的映射。

GET <IndeName>/<Type>/_mapping 
相關問題