2014-09-25 20 views
0

我已經插入一條記錄在ElasticSearch一個我可以看到,在這裏:
Elastic Search Bool Query爲什麼我可以使用bool查詢在彈性搜索中檢索記錄?

但這個查詢返回什麼:

{ 
    "query": { 
    "filtered": { 
     "query": { 
     "bool": { 
      "must": { 
      "term": { 
       "name": "Ehsanl" 
      } 
      } 
     } 
     } 
    } 
    } 
} 

我發佈使用post方法給這個用戶這個查詢:http://127.0.0.1:9200/mydb/customers2/_search 那有什麼問題?

回答

0

嘗試命名爲「ehsanl」。全部以小寫字母表示。

0

您在屏幕截圖上看到的內容是您爲其索引的原始文檔(_source字段)。

但是,默認情況下會分析字符串字段(有關分析的更多詳細信息,請參閱此answer)。

使用standard分析儀,你的名字值應該已經小寫來ehsanl並以這種方式存儲在索引:term查詢搜索索引,這是不存在的確切值Ehsanl

您可以:

  • 使用ehsanl值與term查詢
  • 使用Ehsanl值與match查詢,將適用同樣的分析儀之前進行搜索。