中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

國(guó)家示范校建設(shè)成果網(wǎng)站百度快照排名

國(guó)家示范校建設(shè)成果網(wǎng)站,百度快照排名,使用萬(wàn)網(wǎng)怎么做網(wǎng)站,濟(jì)南網(wǎng)站建設(shè)多少錢作者:Ioana-Alina Tagirta Elastic App Search 中的引擎(engines)使你能夠索引文檔并提供開(kāi)箱即用的可調(diào)搜索功能。 默認(rèn)情況下,引擎支持預(yù)定義的語(yǔ)言列表。 如果你的語(yǔ)言不在該列表中,此博客將說(shuō)明如何添加對(duì)其他語(yǔ)言…

作者:Ioana-Alina Tagirta

?

Elastic App Search 中的引擎(engines)使你能夠索引文檔并提供開(kāi)箱即用的可調(diào)搜索功能。 默認(rèn)情況下,引擎支持預(yù)定義的語(yǔ)言列表。 如果你的語(yǔ)言不在該列表中,此博客將說(shuō)明如何添加對(duì)其他語(yǔ)言的支持。 我們將通過(guò)創(chuàng)建一個(gè) App Search 引擎來(lái)實(shí)現(xiàn)這一點(diǎn),該引擎具有針對(duì)該語(yǔ)言設(shè)置的分析器。

在我們深入細(xì)節(jié)之前,讓我們定義什么是 Elasticsearch 分析器:

Elasticsearch 分析器是一個(gè)包含三個(gè)較低級(jí)別構(gòu)建塊的包:字符過(guò)濾器、標(biāo)記器和標(biāo)記過(guò)濾器。 分析器可以是內(nèi)置的或定制的。 內(nèi)置分析器將構(gòu)建塊預(yù)打包到適合不同語(yǔ)言和文本類型的分析器中。更多關(guān)于 Analyzer 的內(nèi)容,請(qǐng)參閱文章 “Elasticsearch: analyzer”。

?每個(gè)字段的分析器用于:

  • 索引文檔。 每個(gè)文檔字段都將使用其相應(yīng)的分析器進(jìn)行處理,并分解為分詞以方便搜索。
  • 搜索文檔。 將分析 search query 以確保與已分析的索引字段正確匹配。

基于 Elasticsearch 索引的引擎使你能夠從現(xiàn)有的 Elasticsearch 索引創(chuàng)建 App Search 引擎。 我們將使用我們自己的分析器和映射創(chuàng)建一個(gè) Elasticsearch 索引,并在 App Search 中使用該索引。

這個(gè)過(guò)程有四個(gè)步驟:

  1. 創(chuàng)建 Elasticsearch 索引和索引文檔
  2. 將語(yǔ)言分析器添加到該索引
  3. 更新索引映射以使用分析器
  4. 重新索引文檔

1)創(chuàng)建 Elasticsearch 索引和索引文檔

首先,讓我們使用一個(gè)尚未針對(duì)任何語(yǔ)言進(jìn)行優(yōu)化的索引。 假設(shè)這是一個(gè)沒(méi)有預(yù)定義映射的新索引,它是在第一次為文檔建立索引時(shí)創(chuàng)建的。

在 Elasticsearch 中,映射(mapping)是定義文檔及其包含的字段如何存儲(chǔ)和索引的過(guò)程。 每個(gè)文檔都是字段的集合,每個(gè)字段都有自己的數(shù)據(jù)類型。 映射數(shù)據(jù)時(shí),你創(chuàng)建一個(gè)映射定義,其中包含與文檔相關(guān)的字段列表。

回到我們的例子。 該索引稱為 books,title 為羅馬尼亞語(yǔ)。 我們選擇羅馬尼亞語(yǔ)是因?yàn)樗俏业恼Z(yǔ)言,它不包含在 App Search 默認(rèn)支持的語(yǔ)言列表中。

POST books/_doc/1
{"title": "Un veac de singur?tate","author": "Gabriel García Márquez"
}POST books/_doc/2
{"title": "Dragoste ?n vremea holerei","author": "Gabriel García Márquez"
}POST books/_doc/3
{"title": "Obosit de via??, obosit de moarte","author": "Mo Yan"
}POST books/_doc/4
{"title": "Maestrul ?i Margareta","author": "Mihail Bulgakov"
}

2)增加語(yǔ)言分析器到書(shū)籍索引

當(dāng)我們檢查 books 索引映射時(shí),我們發(fā)現(xiàn)它沒(méi)有針對(duì)羅馬尼亞語(yǔ)進(jìn)行優(yōu)化。 你可以看出 settings 塊中沒(méi)有 analysis 字段,并且文本字段不使用自定義分析器。

GET books
{"books": {"aliases": {},"mappings": {"properties": {"author": {"type": "text","fields": {"keyword": {"type": "keyword","ignore_above": 256}}},"title": {"type": "text","fields": {"keyword": {"type": "keyword","ignore_above": 256}}}}},"settings": {"index": {"routing": {"allocation": {"include": {"_tier_preference": "data_content"}}},"number_of_shards": "1","provided_name": "books","creation_date": "1679310576178","number_of_replicas": "1","uuid": "0KuiDk8iSZ-YHVQGg3B0iw","version": {"created": "8080099"}}}}
}

如果我們嘗試使用? books 索引創(chuàng)建 App Search 引擎,我們會(huì)遇到兩個(gè)問(wèn)題。 首先,搜索結(jié)果將不會(huì)針對(duì)羅馬尼亞語(yǔ)進(jìn)行優(yōu)化,其次,精確調(diào)整等功能將被禁用。

關(guān)于不同類型的 Elastic App Search 引擎的快速說(shuō)明:

  • 默認(rèn)選項(xiàng)是 App Search 托管引擎,它將自動(dòng)創(chuàng)建和管理隱藏的 Elasticsearch 索引。 使用此選項(xiàng),你必須使用 App Search 文檔 API 在引擎中提取數(shù)據(jù)。
  • 對(duì)于另一個(gè)選項(xiàng),App Search 會(huì)創(chuàng)建一個(gè)具有現(xiàn)有 Elasticsearch 索引的引擎 —— 在這種情況下,App Search 將按原樣使用該索引。 在這里,你可以使用 Elasticsearch 索引文檔 API 直接在底層索引中提取數(shù)據(jù)。

[相關(guān)文章:Elasticsearch Search API:一種定位 App Search 文檔的新方法]

當(dāng)你從現(xiàn)有 Elasticsearch 索引創(chuàng)建引擎時(shí),如果映射不遵循 App Search 約定,則不會(huì)為該引擎啟用所有功能。 讓我們通過(guò)查看完全由 App Search 管理的引擎來(lái)更仔細(xì)地了解 App Search 映射約定。 該引擎有兩個(gè)字段,title 和 author,并使用英語(yǔ)。

GET .ent-search-engine-documents-app-search-books/_mapping/field/title
{".ent-search-engine-documents-app-search-books": {"mappings": {"title": {"full_name": "title","mapping": {"title": {"type": "text","fields": {"date": {"type": "date","format": "strict_date_time||strict_date","ignore_malformed": true},"delimiter": {"type": "text","index_options": "freqs","analyzer": "iq_text_delimiter"},"enum": {"type": "keyword","ignore_above": 2048},"float": {"type": "double","ignore_malformed": true},"joined": {"type": "text","index_options": "freqs","analyzer": "i_text_bigram","search_analyzer": "q_text_bigram"},"location": {"type": "geo_point","ignore_malformed": true,"ignore_z_value": false},"prefix": {"type": "text","index_options": "docs","analyzer": "i_prefix","search_analyzer": "q_prefix"},"stem": {"type": "text","analyzer": "iq_text_stem"}},"index_options": "freqs","analyzer": "iq_text_base"}}}}}
}

你會(huì)看到 title 字段有幾個(gè)子字段。date、float 和 location 子字段不是文本字段。

在這里,我們感興趣的是如何設(shè)置 App Search 需要的文本字段。 多了幾個(gè)字段! 此文檔頁(yè)面解釋了 App Search 中使用的文本字段。 讓我們看看 App Search 為屬于 App Search 托管引擎的隱藏索引設(shè)置的分析器:

GET .ent-search-engine-documents-app-search-books/_settings/index.analysis*
{".ent-search-engine-documents-app-search-books": {"settings": {"index": {"analysis": {"filter": {"front_ngram": {"type": "edge_ngram","min_gram": "1","max_gram": "12"},"bigram_joiner": {"max_shingle_size": "2","token_separator": "","output_unigrams": "false","type": "shingle"},"bigram_max_size": {"type": "length","max": "16","min": "0"},"en-stem-filter": {"name": "light_english","type": "stemmer"},"bigram_joiner_unigrams": {"max_shingle_size": "2","token_separator": "","output_unigrams": "true","type": "shingle"},"delimiter": {"split_on_numerics": "true","generate_word_parts": "true","preserve_original": "false","catenate_words": "true","generate_number_parts": "true","catenate_all": "true","split_on_case_change": "true","type": "word_delimiter_graph","catenate_numbers": "true","stem_english_possessive": "true"},"en-stop-words-filter": {"type": "stop","stopwords": "_english_"}},"analyzer": {"i_prefix": {"filter": ["cjk_width","lowercase","asciifolding","front_ngram"],"tokenizer": "standard"},"iq_text_delimiter": {"filter": ["delimiter","cjk_width","lowercase","asciifolding","en-stop-words-filter","en-stem-filter"],"tokenizer": "whitespace"},"q_prefix": {"filter": ["cjk_width","lowercase","asciifolding"],"tokenizer": "standard"},"iq_text_base": {"filter": ["cjk_width","lowercase","asciifolding","en-stop-words-filter"],"tokenizer": "standard"},"iq_text_stem": {"filter": ["cjk_width","lowercase","asciifolding","en-stop-words-filter","en-stem-filter"],"tokenizer": "standard"},"i_text_bigram": {"filter": ["cjk_width","lowercase","asciifolding","en-stem-filter","bigram_joiner","bigram_max_size"],"tokenizer": "standard"},"q_text_bigram": {"filter": ["cjk_width","lowercase","asciifolding","en-stem-filter","bigram_joiner_unigrams","bigram_max_size"],"tokenizer": "standard"}}}}}}
}

如果我們想為不同的語(yǔ)言(例如挪威語(yǔ)、芬蘭語(yǔ)或阿拉伯語(yǔ))創(chuàng)建一個(gè)可以在 App Search 中使用的索引,我們將需要類似的分析器。 對(duì)于我們的示例,我們需要確保詞干和停用詞過(guò)濾器使用羅馬尼亞語(yǔ)版本。

回到我們最初的 books 索引,讓我們添加正確的分析器。

在這里快速警告一下。 對(duì)于現(xiàn)有索引,分析器是一種 Elasticsearch 設(shè)置,只能在索引關(guān)閉時(shí)更改。 在這種方法中,我們從現(xiàn)有索引開(kāi)始,因此需要關(guān)閉索引、添加分析器,然后 reopen 索引。

注意:作為替代方案,你也可以使用正確的映射從頭開(kāi)始重新創(chuàng)建索引,然后索引所有文檔。 如果這更適合你的用例,請(qǐng)隨意跳過(guò)本指南中討論打開(kāi)和關(guān)閉索引以及重新索引的部分。

你可以通過(guò)運(yùn)行 POST books/_close 來(lái)關(guān)閉索引。 之后,我們將添加分析器:

PUT books/_settings
{"analysis": {"filter": {"front_ngram": {"type": "edge_ngram","min_gram": "1","max_gram": "12"},"bigram_joiner": {"max_shingle_size": "2","token_separator": "","output_unigrams": "false","type": "shingle"},"bigram_max_size": {"type": "length","max": "16","min": "0"},"ro-stem-filter": {"name": "romanian","type": "stemmer"},"bigram_joiner_unigrams": {"max_shingle_size": "2","token_separator": "","output_unigrams": "true","type": "shingle"},"delimiter": {"split_on_numerics": "true","generate_word_parts": "true","preserve_original": "false","catenate_words": "true","generate_number_parts": "true","catenate_all": "true","split_on_case_change": "true","type": "word_delimiter_graph","catenate_numbers": "true"},"ro-stop-words-filter": {"type": "stop","stopwords": "_romanian_"}},"analyzer": {"i_prefix": {"filter": ["cjk_width","lowercase","asciifolding","front_ngram"],"tokenizer": "standard"},"iq_text_delimiter": {"filter": ["delimiter","cjk_width","lowercase","asciifolding","ro-stop-words-filter","ro-stem-filter"],"tokenizer": "whitespace"},"q_prefix": {"filter": ["cjk_width","lowercase","asciifolding"],"tokenizer": "standard"},"iq_text_base": {"filter": ["cjk_width","lowercase","asciifolding","ro-stop-words-filter"],"tokenizer": "standard"},"iq_text_stem": {"filter": ["cjk_width","lowercase","asciifolding","ro-stop-words-filter","ro-stem-filter"],"tokenizer": "standard"},"i_text_bigram": {"filter": ["cjk_width","lowercase","asciifolding","ro-stem-filter","bigram_joiner","bigram_max_size"],"tokenizer": "standard"},"q_text_bigram": {"filter": ["cjk_width","lowercase","asciifolding","ro-stem-filter","bigram_joiner_unigrams","bigram_max_size"],"tokenizer": "standard"}}}
}

你可以看到,我們正在添加 ro-stem-filter 以提取羅馬尼亞語(yǔ)的詞干,這將提高羅馬尼亞語(yǔ)特定單詞變體的搜索相關(guān)性。 我們包括羅馬尼亞語(yǔ)停用詞過(guò)濾器 (ro-stop-words-filter) 以確保羅馬尼亞語(yǔ)停用詞不被考慮用于搜索目的。

現(xiàn)在我們將通過(guò)執(zhí)行 POST books/_open 重新打開(kāi)索引。

3)更新索引映射以使用分析器

一旦我們有了分析設(shè)置,我們就可以修改索引映射。 App Search 使用動(dòng)態(tài)模板來(lái)確保新字段具有正確的子字段和分析器。 對(duì)于我們的示例,我們只會(huì)將子字段添加到現(xiàn)有的 title 和 author 字段中:

PUT books/_mapping
{"properties": {"author": {"type": "text","fields": {"delimiter": {"type": "text","index_options": "freqs","analyzer": "iq_text_delimiter"},"enum": {"type": "keyword","ignore_above": 2048},"joined": {"type": "text","index_options": "freqs","analyzer": "i_text_bigram","search_analyzer": "q_text_bigram"},"prefix": {"type": "text","index_options": "docs","analyzer": "i_prefix","search_analyzer": "q_prefix"},"stem": {"type": "text","analyzer": "iq_text_stem"}}},"title": {"type": "text","fields": {"delimiter": {"type": "text","index_options": "freqs","analyzer": "iq_text_delimiter"},"enum": {"type": "keyword","ignore_above": 2048},"joined": {"type": "text","index_options": "freqs","analyzer": "i_text_bigram","search_analyzer": "q_text_bigram"},"prefix": {"type": "text","index_options": "docs","analyzer": "i_prefix","search_analyzer": "q_prefix"},"stem": {"type": "text","analyzer": "iq_text_stem"}}}}
}

4)重新索引文檔

books 索引現(xiàn)在幾乎可以在 App Search 中使用了!

我們只需要確保我們?cè)谛薷挠成渲八饕奈臋n具有所有正確的子字段。 為此,我們可以使用 update_by_query 就地運(yùn)行重建索引:

POST books/_update_by_query?refresh
{"query": {"match_all": {}}
}

由于我們使用的是 match_all 查詢,因此所有現(xiàn)有文檔都將被更新。

通過(guò)?update by query 請(qǐng)求,我們還可以包含一個(gè)腳本參數(shù)來(lái)定義如何更新文檔。

請(qǐng)注意,我們沒(méi)有更改文檔,但我們確實(shí)希望按原樣重新索引現(xiàn)有文檔,以確保文本字段 author 和 title 具有正確的子字段。 因此,我們不需要在我們的查詢請(qǐng)求更新中包含腳本。

我們現(xiàn)在有一個(gè)語(yǔ)言優(yōu)化的索引,我們可以在帶有 Elasticsearch 引擎的 App Search 中使用! 你將在以下屏幕截圖中看到實(shí)際的好處。

我們將使用書(shū)名 One Hundred Years of Solitude?作為參考。 羅馬尼亞語(yǔ)的翻譯標(biāo)題是 Un veac de singur?tate。 注意 veac 這個(gè)詞,它是羅馬尼亞語(yǔ)中 “世紀(jì)” 的意思。 我們將使用 veac 的復(fù)數(shù)形式進(jìn)行搜索,即 veacuri。 我們?cè)趯⒁榭吹膬蓚€(gè)示例中都提取了此數(shù)據(jù)記錄:

{"title": "Un veac de singur?tate","author": "Gabriel García Márquez"
}

當(dāng)索引未針對(duì)某種語(yǔ)言進(jìn)行優(yōu)化時(shí),羅馬尼亞書(shū)名 Un veac de singur?tate 將使用標(biāo)準(zhǔn)分析器進(jìn)行索引,該分析器適用于大多數(shù)語(yǔ)言,但可能并不總是與相關(guān)文檔匹配。 搜索 veacuri 不會(huì)顯示任何結(jié)果,因?yàn)榇怂阉鬏斎肱c數(shù)據(jù)記錄中的任何純文本都不匹配。

然而,在使用語(yǔ)言優(yōu)化索引時(shí),當(dāng)我們搜索 veacuri 時(shí),Elastic App Search 會(huì)將其與羅馬尼亞語(yǔ)單詞 veac 相匹配,并返回我們要查找的數(shù)據(jù)。 相關(guān)調(diào)整視圖中也提供精確調(diào)整字段! 查看此圖像中所有突出顯示的位:

因此,我們?cè)?Elastic Enterprise Search 中添加了對(duì)羅馬尼亞語(yǔ)的支持,這是我的語(yǔ)言! 可以復(fù)制本指南中使用的過(guò)程來(lái)創(chuàng)建針對(duì) Elasticsearch 支持的任何其他語(yǔ)言優(yōu)化的索引。 有關(guān) Elasticsearch 中支持的語(yǔ)言分析器的完整列表,請(qǐng)查看此文檔頁(yè)面。

Elasticsearch 中的分析器是一個(gè)引人入勝的話題。 如果你有興趣了解更多信息,這里有一些其他資源:

  • Elasticsearch 文本分析概述文檔頁(yè)面
  • Elasticsearch 內(nèi)置分析器參考文檔頁(yè)面(有關(guān)支持的語(yǔ)言分析器列表,請(qǐng)參閱此子頁(yè)面。)
  • 了解有關(guān) Elastic Enterprise Search 和 Elastic Cloud 試用的更多信息
http://www.risenshineclean.com/news/2854.html

相關(guān)文章:

  • 網(wǎng)站建設(shè)專用圖形庫(kù)seo網(wǎng)站內(nèi)容優(yōu)化有哪些
  • 虛擬空間官網(wǎng)衡陽(yáng)有實(shí)力seo優(yōu)化
  • 睢寧網(wǎng)站建設(shè)xzqjwl深圳推廣公司有哪些
  • 網(wǎng)站開(kāi)發(fā)開(kāi)題報(bào)告怎樣推廣一個(gè)產(chǎn)品
  • 費(fèi)縣做網(wǎng)站收錄提交入口網(wǎng)址
  • wordpress 做公司網(wǎng)站網(wǎng)絡(luò)營(yíng)銷的推廣
  • 網(wǎng)站下雪的效果怎么做的一鍵制作網(wǎng)站
  • 個(gè)人網(wǎng)站模板之家吳中seo網(wǎng)站優(yōu)化軟件
  • 網(wǎng)站做采集會(huì)有問(wèn)題么寧波最好的推廣平臺(tái)
  • 哪家專門做特賣網(wǎng)站百度搜索網(wǎng)頁(yè)
  • wordpress 簡(jiǎn)約windows優(yōu)化大師最新版本
  • 常熟網(wǎng)站建設(shè)icp備案長(zhǎng)沙網(wǎng)址seo
  • 最專業(yè)的佛山網(wǎng)站建設(shè)牛排seo系統(tǒng)
  • 做的網(wǎng)站晚上偷偷看b站軟件推薦
  • 網(wǎng)站建設(shè)網(wǎng)絡(luò)推廣加盟蘇州seo公司
  • 網(wǎng)站做線旅游景區(qū)網(wǎng)絡(luò)營(yíng)銷案例
  • 新疆建設(shè)職業(yè)培訓(xùn)中心網(wǎng)站線上營(yíng)銷推廣方案有哪些
  • 赤峰浩誠(chéng)網(wǎng)站建設(shè)有限公司百度店鋪
  • 長(zhǎng)白山網(wǎng)站學(xué)做管理下載百度2023最新版
  • 網(wǎng)站成本廣告公司網(wǎng)站制作
  • wap手機(jī)百度seo排名工具
  • 網(wǎng)站聊天系統(tǒng)怎么做友情網(wǎng)站
  • 住房和城鄉(xiāng)建設(shè)部電工證廊坊優(yōu)化技巧
  • 網(wǎng)頁(yè)使用怎么做太原seo推廣
  • 袁隆平網(wǎng)站設(shè)計(jì)模板貴州seo和網(wǎng)絡(luò)推廣
  • wordpress主題轉(zhuǎn)zblog網(wǎng)站網(wǎng)頁(yè)的優(yōu)化方法
  • 做高仿批發(fā)的網(wǎng)站有哪些百度熱門排行榜
  • 如何用nat123做網(wǎng)站做網(wǎng)站用哪個(gè)軟件
  • 南通營(yíng)銷型網(wǎng)站建設(shè)自媒體平臺(tái)注冊(cè)官網(wǎng)
  • 網(wǎng)站后臺(tái)上傳圖片 不可用提高網(wǎng)站排名