2017-07-18 108 views
1

說我有一個句子This is a new cityanagram的彈性搜索索引?

  1. 是否鬆緊搜索詞的所有可能的排列/組合創建索引。例如,對於「城市」這個詞,它會創建索引「it」,「ty」,「ity」,「cit」等嗎?
  2. 這些索引是在文檔存儲時還是在運行時創建的?
  3. 這些索引是否保存在內存或數據庫中?

回答

0
  1. 這取決於你tokenizer。默認情況下Elasticsearch使用Standant Tokenizer其中divides text into terms on word boundaries, as defined by the Unicode Text Segmentation algorithm.這意味着您的句子將被標記爲this, is, a, new, city。如果您願意,您可以創建自定義標記。

  2. 將文檔放到Elasticsearch中時,文檔會被編入索引。

  3. 的數據被保存在文件系統:https://www.elastic.co/blog/found-dive-into-elasticsearch-storage

這裏是一個博客帖子大約內部:https://www.elastic.co/blog/found-elasticsearch-from-the-bottom-up

+0

一個上點1.問題將彈性搜索無法搜索單詞'city'時我默認輸入部分單詞「it」?我是否需要創建自定義標記器以在每個單詞的可能字母上創建索引? – user3198603

+0

它根據您的查詢類型進行更改。對於這樣的匹配,你可以使用帶'* it *'的通配符查詢。請參閱:https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-matching.html。 – alpert

+0

當你說'對於這樣的比賽,你可以使用..'你問最終用戶使用通配符嗎?我以爲ES會自動做到這一點? – user3198603