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

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

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的更多相关文章

  1. elasticsearch文档-analysis

    elasticsearch文档-analysis   analysis 基本概念 全文搜索引擎会用某种算法对要建索引的文档进行分析, 从文档中提取出若干Token(词元), 这些算法称为Tokeniz ...

  2. ES系列六、ES字段类型及ES内置analyzer分析

    一.背景知识 在Es中,字段的类型很关键: 在索引的时候,如果字段第一次出现,会自动识别某个类型,这种规则之前已经讲过了. 那么如果一个字段已经存在了,并且设置为某个类型.再来一条数据,字段的数据不与 ...

  3. ElasticSearch入门 第七篇:分词

    这是ElasticSearch 2.4 版本系列的第七篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...

  4. ElasticSearch:分析器

    ElasticSearch入门 第七篇:分析器 这是ElasticSearch 2.4 版本系列的第七篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch El ...

  5. elasticsearch 分析器 分词器

    参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-tokenizers.html 在全文搜索(Fu ...

  6. python 中的高级函数filter()

    filter()函数是 Python 内置的另一个有用的高阶函数,filter()函数接收一个函数 f 和一个list,这个函数 f 的作用是对每个元素进行判断,返回 True或 False,filt ...

  7. python基础——filter函数

    python基础——filter函数 Python内建的filter()函数用于过滤序列. 和map()类似,filter()也接收一个函数和一个序列.和map()不同的是,filter()把传入的函 ...

  8. filter()函数 条件筛选

    filter()函数 filter()函数是 Python 内置的另一个有用的高阶函数,filter()函数接收一个函数 f 和一个list,这个函数 f 的作用是对每个元素进行判断,返回 True或 ...

  9. filter 过滤序列

    class filter(object): """ filter(function or None, iterable) --> filter object Ret ...

随机推荐

  1. Python运维开发基础04-语法基础

    上节作业回顾(讲解+温习90分钟) #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen # 仅用列表+循环实现"简单 ...

  2. Linux学习---新建文件,查看文件,修改权限,删除

    过程:在一个文件夹下面新建一个文件,然后查看文件,再修改权限,运行,最后删除 1.新建文件: touch  Test.sh 补充:新建文件有好多种方式,一般用mkdir(创建目录,即文件夹).touc ...

  3. shell脚本学习指南-学习(1)

    1.先看下面这个命令: $who  | wc  -l  计算当前登陆的用户个数: $who   当前登陆的有哪些用户: pipeling(   |  )可以在两个程序之间建立管道,左侧的结果成为右侧的 ...

  4. Inclusion–exclusion principle(动态规划)

    QUESTION: 把(2, 3, 5, 7)称为primes,能被primes整除的我们称之为Walprimes,比如 -21, -30, 0, 5, 14 是, 而-121, 1, 143 etc ...

  5. Golang作用域—坑

    先举个栗子,全局作用域变量,与 := 符号声明赋值新变量 package main import "fmt" var a = "GG" func main() ...

  6. 光源 材质 简析——基于《real time rendering》第三版 第五章

    对于真是世界的渲染,有三个重要的组成部分,光源,材质,以及摄像机.下面,我们一个一个来简单介绍一下. 光源:方向光,点光源,聚光灯.但是,在和物体表面交互的时候,光源对物体表面的影响是依赖光的辐照度( ...

  7. Workflow笔记2——状态机工作流(转)

    出处:http://www.cnblogs.com/jiekzou/p/6192813.html 在上一节Workflow笔记1——工作流介绍中,介绍的是流程图工作流,后来微软又推出了状态机工作流,它 ...

  8. mongodb-win32-i386-3.0.6 使用

    一.下载地址 https://fastdl.mongodb.org/win32/mongodb-win32-i386-3.0.6.zip 二.安装 1. systeminfo OS 名称: Micro ...

  9. Codeforces768B Code For 1 2017-02-21 22:17 95人阅读 评论(0) 收藏

    B. Code For 1 time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  10. OpenGL中常用的函数

    OPengl的官方文档如下:https://www.opengl.org/sdk/docs/man4/ void glGetIntegerv(   GLenum pname,      GLint * ...