# HTML Strip Character Filter(HTML标签过滤)

**HTML Strip Character Filter** 会删除文本中**的HTML**元素，并且将**HTML**实体替换成对应的解码值（例如&#x7528;**＆**&#x66FF;&#x6362;**＆amp;**）。

## **输出示例**

```
POST _analyze
{
  "tokenizer":      "keyword",
  "char_filter":  [ "html_strip" ],
  "text": "<p>I&apos;m so <b>happy</b>!</p>"
}
```

> keyword分词器只会返回一个词元(**term**), 也就是整体返回。

上面的案例将会返回如下的词元(**term**)：

```
[ \nI'm so happy!\n ]
```

同样的示例，如果使用标准分词器(**standar tokenizer**)将会返回的词元(**term**)如下：

```
[ I'm, so, happy ]
```

## 配置

**HTML Strip Character Filter**接收如下参数：

| 参数名称           | 说明             |
| -------------- | -------------- |
| `escaped_tags` | 会原始文本中保留的一系列标签 |

配置示例：

```
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>"
}
```

上面示例将返回如下结果：

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/33-analysisfen-679029/336character-filtersff08-zi-fu-guo-lv-qi-ff09/html-strip-character-filter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
