HTML Strip Char Filter

來源:互聯網
上載者:User

標籤:load   param   parameter   curl   nbsp   analysis   conf   should   sci   

The html_strip character filter strips HTML elements from the text and replaces HTML entities with their decoded value (e.g. replacing & with &).

Example outputedit
POST _analyze{  "tokenizer":      "keyword", 
  "char_filter":  [ "html_strip" ],  "text": "<p>I&apos;m so <b>happy</b>!</p>"}
COPY AS CURLVIEW IN CONSOLE 

The keyword tokenizer returns a single term.

The above example returns the term:

[ \nI‘m so happy!\n ]

The same example with the standard tokenizer would return the following terms:

[ I‘m, so, happy ]
Configurationedit

The html_strip character filter accepts the following parameter:

escaped_tags

An array of HTML tags which should not be stripped from the original text.

Example configurationedit

In this example, we configure the html_strip character filter to leave <b> tags in place:

PUT my_index{  "settings": {    "analysis": {      "analyzer": {        "my_analyzer": {          "tokenizer": "keyword",          "char_filter": ["my_char_filter"]        }      },      "char_filter": {        "my_char_filter": {          "type": "html_strip",          "escaped_tags": ["b"]        }      }    }  }}POST my_index/_analyze{  "analyzer": "my_analyzer",  "text": "<p>I&apos;m so <b>happy</b>!</p>"}
COPY AS CURLVIEW IN CONSOLE 

The above example produces the following term:

[ \nI‘m so <b>happy</b>!\n ]


源文:https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html#analysis-htmlstrip-charfilter

HTML Strip Char Filter

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.