ES6.8.6 创建索引配置分词器、映射字段指定分词器、查询数据高亮显示分词结果(内置分词器、icu、ik、pinyin分词器)

文章目录

    • ES环境
    • 内置分词器,以`simple分词器`示例查询
      • 创建索引`simple_news`,修改分词器为`simple`
      • 插入模拟数据
      • 分词查询:返回通过分词查询到的结果、高亮分词
      • 分词匹配:写一次示例,其他分词和匹配思路基本一致
        • 第一步:对输入值`三毛 我愿一生流浪 天才作家`进行分词
        • 第二步:被匹配到的`title="我愿一生流浪 | 三毛《撒哈拉的故事"`值进行分词
        • 查询词和`title`值匹配结果高亮
    • icu分词器
      • 创建索引`icu_news`,修改分词器为`icu_analyzer`
      • 插入模拟数据
      • 查询,返回通过分词查询到的结果、高亮的分词
    • ik分词器,以`ik_max_word`模式示例查询
      • 创建索引`ik_news`,修改分词器为`ik_max_word`
      • 插入模拟数据
      • 查询,返回通过分词查询到的结果、高亮的分词
    • pinyin分词器
      • 创建索引`pinyin_news`
      • 插入模拟数据
      • 查询,返回通过分词查询到的结果、高亮的分词
    • 参考链接

了解分词器是如何分词?分词结果是什么?可以看上一篇文章:

【ES6.8.6 分词器安装&使用、查询分词结果(内置分词器、icu、ik、pinyin分词器)-CSDN博客】

ES环境

  • elasticsearch6.8.6版本:已安装ik分词器、icu分词器、pinyin分词器(分词器版本要和es版本一致)
  • postman测试工具
  • 视图工具elasticsearch-head(https://github.com/mobz/elasticsearch-head)

注!

  • 以下postman截图中{{domain}}等于 http://127.0.0.1:9200
  • 以下全部用default配置默认分词器
"settings": {"analysis": {"analyzer": {"default": {# 修改默认分词器,使用内置或者三方分词器提供的默认名称: icu_analyzer、ik_smart、pinyin等	"type": "simple"}}}
}

        如果需要了解自定义分词器配置,可以看:

        【ES6.8.6 为索引映射(Mapping)创建自定义分词器,测试分词匹配效果-CSDN博客】

内置分词器,以simple分词器示例查询

创建索引simple_news,修改分词器为simple

image.png

# 创建索引命令
PUT /simple_news参数:
{"settings": {"analysis": {"analyzer": {"default": {# 修改默认分词器"type": "simple"}}}},"mapping": {"_doc": {"properties": {"id": {"type": "long"},"title": {"type": "text",# 为字段指定分词器"analyzer": "simple"},"uv": {"type": "long"},"create_date": {"type": "date"},"status": {"type": "int"},"remark": {"type": "text",# 为字段指定分词器"analyzer": "simple"}}}}
}

插入模拟数据

image.png

# 批量新增
POST /simple_news/_doc/_bulk参数{"index": {"_id": 1}}
{"id":1,"title":"三毛:她把短暂的一生,活成了十世","uv":120,"create_date":"2024-01-15","status":1,"remark":"来源百度搜索"}
{"index": {"_id": 2}}
{"id":2,"title":"我愿一生流浪 | 三毛《撒哈拉的故事","uv":99,"create_date":"2024-01-14","status":1,"remark":"来源知乎搜索"}
{"index": {"_id": 3}}
{"id":3,"title":"离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv":80,"create_date":"2024-01-15","status":1,"remark":"来源搜狐"}
{"index": {"_id": 4}}
{"id":4,"title":"三毛逝世30周年丨一场与三毛穿越时空的对话","uv":150,"create_date":"2024-01-16","status":1,"remark":"来源澎湃新闻"}
{"index": {"_id": 5}}
{"id":5,"title":"三毛:从自闭少女到天才作家","uv":141,"create_date":"2024-01-18","status":1,"remark":"来源光明网"}
{"index": {"_id": 6}}
{"id":6,"title":"超全整理!三毛最出名的11本著作,没读过的一定要看看","uv":200,"create_date":"2024-01-23","status":1,"remark":"来源知乎搜索"}
{"index": {"_id": 7}}
{"id":7,"title":"三毛的英文名为什么叫Echo?","uv":300,"create_date":"2024-01-21","status":1,"remark":"来源百度知道"}
{"index": {"_id": 8}}
{"id":8,"title":"毛国家统计局发布第三季度贸易数据","uv":50,"create_date":"2024-01-23","status":1,"remark":"来源中华人民共和国商务部"}
{"index": {"_id": 9}}
{"id":9,"title":"网易公布2022年第三季度财报|净收入|毛利润","uv":131,"create_date":"2024-01-22","status":1,"remark":"来源网易科技"}
{"index": {"_id": 10}}
{"id":10,"title":"单季盈利超100亿元!比亚迪三季度毛利率超特斯拉","uv":310,"create_date":"2024-01-23","status":1,"remark":"来源新浪财经"}
# 最后要有一空行
# 批量新增数据要以换行分割

插入的数据:
image.png

分词查询:返回通过分词查询到的结果、高亮分词

【es官网,高亮查询配置】

image.png

# 查询索引simple_news内数据
POST /simple_news/_search# 参数{"query": {"bool": {"must": {"match": {# 查询的字段title:值会被simple进行分词,然后到表格中匹配数据"title": "三毛 我愿一生流浪 天才作家"}}}},# 高亮结果显示配置"highlight": {# 需要高亮显示的字段"fields": {"remark": {},"title": {}},# 设置分段的数量不做限制"number_of_fragments": 0,# 根据哪个分词配到到的结果进行高亮显示"post_tags": ["</b>"],"pre_tags": ["<b>"],"require_field_match": false,"type": "plain"},"from": 0,"size": 10000,"sort": [],"aggs": {}
}

查询结果和返回高亮的词:

{"took": 6,"timed_out": false,"_shards": {"total": 5,"successful": 5,"skipped": 0,"failed": 0},"hits": {"total": 4,"max_score": 1.9616584,"hits": [{"_index": "simple_news","_type": "_doc","_id": "2","_score": 1.9616584,"_source": {"id": 2,"title": "我愿一生流浪 | 三毛《撒哈拉的故事","uv": 99,"create_date": "2024-01-14","status": 1,"remark": "来源知乎搜索"},"highlight": {"title": ["<b>我愿一生流浪</b> | <b>三毛</b>《撒哈拉的故事"]}},{"_index": "simple_news","_type": "_doc","_id": "5","_score": 1.3112576,"_source": {"id": 5,"title": "三毛:从自闭少女到天才作家","uv": 141,"create_date": "2024-01-18","status": 1,"remark": "来源光明网"},"highlight": {"title": ["<b>三毛</b>:从自闭少女到天才作家"]}},{"_index": "simple_news","_type": "_doc","_id": "1","_score": 0.5754429,"_source": {"id": 1,"title": "三毛:她把短暂的一生,活成了十世","uv": 120,"create_date": "2024-01-15","status": 1,"remark": "来源百度搜索"},"highlight": {"title": ["<b>三毛</b>:她把短暂的一生,活成了十世"]}},{"_index": "simple_news","_type": "_doc","_id": "3","_score": 0.2876821,"_source": {"id": 3,"title": "离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv": 80,"create_date": "2024-01-15","status": 1,"remark": "来源搜狐"},"highlight": {"title": ["离世33年仍是“华语顶流”,<b>三毛</b>“珍贵录音”揭露人生真相:世界是对的,但我也没错!"]}}]}
}

分词匹配:写一次示例,其他分词和匹配思路基本一致

以上面的查询结果为例,截图如下:

image.png

第一步:对输入值三毛 我愿一生流浪 天才作家进行分词

image.png

# 查询分词结果
GET /simple_news/_analyze# 参数
{"analyzer": "simple","text": "三毛 我愿一生流浪 天才作家"
}

分词结果为:三毛我愿一生流浪天才作家

	{"tokens": [{"token": "三毛","start_offset": 0,"end_offset": 2,"type": "word","position": 0},{"token": "我愿一生流浪","start_offset": 3,"end_offset": 9,"type": "word","position": 1},{"token": "天才作家","start_offset": 10,"end_offset": 14,"type": "word","position": 2}]
}
第二步:被匹配到的title="我愿一生流浪 | 三毛《撒哈拉的故事"值进行分词

        参考对输入的分词,以同样的步骤,对我愿一生流浪 | 三毛《撒哈拉的故事进行分词

image.png

# 查询分词结果
GET /simple_news/_analyze# 参数
{"analyzer": "simple","text": "我愿一生流浪 | 三毛《撒哈拉的故事"
}

分词结果为:我愿一生流浪三毛撒哈拉的故事

{"tokens": [{"token": "我愿一生流浪","start_offset": 0,"end_offset": 6,"type": "word","position": 0},{"token": "三毛","start_offset": 9,"end_offset": 11,"type": "word","position": 1},{"token": "撒哈拉的故事","start_offset": 12,"end_offset": 18,"type": "word","position": 2}]
}
查询词和title值匹配结果高亮

        综合前面两步对三毛 我愿一生流浪 天才作家我愿一生流浪 | 三毛《撒哈拉的故事的分词结果。
        所以被匹配到的词有三毛我愿一生流浪,所以高亮的词(被匹配到的词)就是这两个:

image.png

icu分词器

创建索引icu_news,修改分词器为icu_analyzer

postman请求:
image.png
请求命令:

PUT {{domain}}/icu_news# 参数
{"settings": {"analysis": {"analyzer": {"default": {# 修改分词器名称"type": "icu_analyzer"}}}},"mapping": {"_doc": {"properties": {"id": {"type": "long"},"title": {"type": "text",# 修改分词器"analyzer": "icu_analyzer"},"uv": {"type": "long"},"create_date": {"type": "date"},"status": {"type": "int"},"remark": {"type": "text","analyzer": "icu_analyzer"}}}}
}

插入模拟数据

POST {{domain}}/icu_news/_doc/_bulk# 参数{"index": {"_id": 1}}
{"id":1,"title":"三毛:她把短暂的一生,活成了十世","uv":120,"create_date":"2024-01-15","status":1,"remark":"来源百度搜索"}
{"index": {"_id": 2}}
{"id":2,"title":"我愿一生流浪 | 三毛《撒哈拉的故事","uv":99,"create_date":"2024-01-14","status":1,"remark":"来源知乎搜索"}
{"index": {"_id": 3}}
{"id":3,"title":"离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv":80,"create_date":"2024-01-15","status":1,"remark":"来源搜狐"}
{"index": {"_id": 4}}
{"id":4,"title":"三毛逝世30周年丨一场与三毛穿越时空的对话","uv":150,"create_date":"2024-01-16","status":1,"remark":"来源澎湃新闻"}
{"index": {"_id": 5}}
{"id":5,"title":"三毛:从自闭少女到天才作家","uv":141,"create_date":"2024-01-18","status":1,"remark":"来源光明网"}
{"index": {"_id": 6}}
{"id":6,"title":"超全整理!三毛最出名的11本著作,没读过的一定要看看","uv":200,"create_date":"2024-01-23","status":1,"remark":"来源知乎搜索"}
{"index": {"_id": 7}}
{"id":7,"title":"三毛的英文名为什么叫Echo?","uv":300,"create_date":"2024-01-21","status":1,"remark":"来源百度知道"}
{"index": {"_id": 8}}
{"id":8,"title":"毛国家统计局发布第三季度贸易数据","uv":50,"create_date":"2024-01-23","status":1,"remark":"来源中华人民共和国商务部"}
{"index": {"_id": 9}}
{"id":9,"title":"网易公布2022年第三季度财报|净收入|毛利润","uv":131,"create_date":"2024-01-22","status":1,"remark":"来源网易科技"}
{"index": {"_id": 10}}
{"id":10,"title":"单季盈利超100亿元!比亚迪三季度毛利率超特斯拉","uv":310,"create_date":"2024-01-23","status":1,"remark":"来源新浪财经"}

数据内容同上,除索引名称、分词器不一样外,其他一样:

image.png

查询,返回通过分词查询到的结果、高亮的分词

POST {{domain}}/icu_news/_search# 参数{"query": {"bool": {"must": {"match": {# 查询文本同上,分词方式不同"title": "三毛 我愿一生流浪 天才作家"}}}},"highlight": {"fields": {"remark": {},"title": {}},"number_of_fragments": 0,"post_tags": ["</b>"],"pre_tags": ["<b>"],"require_field_match": false,"type": "plain"},"from": 0,"size": 10000,"sort": [],"aggs": {}
}

分词查询结果:
        通过icu分词器的分词查询,天才作家也进行了高亮,说明通过天才作家匹配到了记录。

{"took": 7,"timed_out": false,"_shards": {"total": 5,"successful": 5,"skipped": 0,"failed": 0},"hits": {"total": 7,"max_score": 4.7378397,"hits": [{"_index": "icu_news","_type": "_doc","_id": "2","_score": 4.7378397,"_source": {"id": 2,"title": "我愿一生流浪 | 三毛《撒哈拉的故事","uv": 99,"create_date": "2024-01-14","status": 1,"remark": "来源知乎搜索"},"highlight": {"title": ["<b>我</b><b>愿</b><b>一生</b><b>流浪</b> | <b>三毛</b>《撒哈拉的故事"]}},{"_index": "icu_news","_type": "_doc","_id": "5","_score": 4.1822214,"_source": {"id": 5,"title": "三毛:从自闭少女到天才作家","uv": 141,"create_date": "2024-01-18","status": 1,"remark": "来源光明网"},"highlight": {"title": ["<b>三毛</b>:从自闭少女到<b>天才</b><b>作家</b>"]}},{"_index": "icu_news","_type": "_doc","_id": "1","_score": 0.83287835,"_source": {"id": 1,"title": "三毛:她把短暂的一生,活成了十世","uv": 120,"create_date": "2024-01-15","status": 1,"remark": "来源百度搜索"},"highlight": {"title": ["<b>三毛</b>:她把短暂的<b>一生</b>,活成了十世"]}},{"_index": "icu_news","_type": "_doc","_id": "3","_score": 0.2876821,"_source": {"id": 3,"title": "离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv": 80,"create_date": "2024-01-15","status": 1,"remark": "来源搜狐"},"highlight": {"title": ["离世33年仍是“华语顶流”,<b>三毛</b>“珍贵录音”揭露人生真相:世界是对的,但我也没错!"]}},{"_index": "icu_news","_type": "_doc","_id": "7","_score": 0.19214728,"_source": {"id": 7,"title": "三毛的英文名为什么叫Echo?","uv": 300,"create_date": "2024-01-21","status": 1,"remark": "来源百度知道"},"highlight": {"title": ["<b>三毛</b>的英文名为什么叫Echo?"]}},{"_index": "icu_news","_type": "_doc","_id": "4","_score": 0.18085617,"_source": {"id": 4,"title": "三毛逝世30周年丨一场与三毛穿越时空的对话","uv": 150,"create_date": "2024-01-16","status": 1,"remark": "来源澎湃新闻"},"highlight": {"title": ["<b>三毛</b>逝世30周年丨一场与<b>三毛</b>穿越时空的对话"]}},{"_index": "icu_news","_type": "_doc","_id": "6","_score": 0.119052075,"_source": {"id": 6,"title": "超全整理!三毛最出名的11本著作,没读过的一定要看看","uv": 200,"create_date": "2024-01-23","status": 1,"remark": "来源知乎搜索"},"highlight": {"title": ["超全整理!<b>三毛</b>最出名的11本著作,没读过的一定要看看"]}}]}
}

ik分词器,以ik_max_word模式示例查询

创建索引ik_news,修改分词器为ik_max_word

PUT {{domain}}/ik_news# 参数{"settings": {"analysis": {"analyzer": {"default": {# 指定ik最大粒度分词"type": "ik_max_word"}}}},"mapping": {"_doc": {"properties": {"id": {"type": "long"},"title": {"type": "text",# 指定ik最大粒度分词"analyzer": "ik_max_word"},"uv": {"type": "long"},"create_date": {"type": "date"},"status": {"type": "int"},"remark": {"type": "text",# 指定ik最大粒度分词"analyzer": "ik_max_word"}}}}
}

插入模拟数据

        (略)数据内容同上,除索引名称、分词器不一样外,其他一样。

查询,返回通过分词查询到的结果、高亮的分词

请求查询命令:

POST {{domain}}/ik_news/_search# 查询参数{"query": {"bool": {"must": {"match": {"title": "三毛 我愿一生流浪 天才作家"}}}},"highlight": {"fields": {"remark": {},"title": {}},"number_of_fragments": 0,"post_tags": ["</b>"],"pre_tags": ["<b>"],"require_field_match": false,"type": "plain"},"from": 0,"size": 10000,"sort": [],"aggs": {}
}

分词查询结果:
        观察高亮标签,对比icu分词器查询的结果更多了。说明ik_max_word对词的拆分粒度更大。
        尤其可以分析以下_id=8的数据,和原本应该查的关系关联度是非常低的。(风马牛不相及)

{"took": 13,"timed_out": false,"_shards": {"total": 5,"successful": 5,"skipped": 0,"failed": 0},"hits": {"total": 10,"max_score": 6.2969456,"hits": [{"_index": "ik_news","_type": "_doc","_id": "2","_score": 6.2969456,"_source": {"id": 2,"title": "我愿一生流浪 | 三毛《撒哈拉的故事","uv": 99,"create_date": "2024-01-14","status": 1,"remark": "来源知乎搜索"},"highlight": {"title": ["<b>我</b><b>愿</b><b>一生</b><b>流浪</b> | <b>三毛</b>《撒哈拉的故事"]}},{"_index": "ik_news","_type": "_doc","_id": "5","_score": 4.8469224,"_source": {"id": 5,"title": "三毛:从自闭少女到天才作家","uv": 141,"create_date": "2024-01-18","status": 1,"remark": "来源光明网"},"highlight": {"title": ["<b>三毛</b>:从自闭少女到<b>天才</b><b>作家</b>"]}},{"_index": "ik_news","_type": "_doc","_id": "1","_score": 2.5841205,"_source": {"id": 1,"title": "三毛:她把短暂的一生,活成了十世","uv": 120,"create_date": "2024-01-15","status": 1,"remark": "来源百度搜索"},"highlight": {"title": ["<b>三毛</b>:她把短暂的<b>一生</b>,活成了十世"]}},{"_index": "ik_news","_type": "_doc","_id": "3","_score": 0.8630463,"_source": {"id": 3,"title": "离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv": 80,"create_date": "2024-01-15","status": 1,"remark": "来源搜狐"},"highlight": {"title": ["离世33年仍是“华语顶流”,<b>三毛</b>“珍贵录音”揭露人生真相:世界是对的,但我也没错!"]}},{"_index": "ik_news","_type": "_doc","_id": "4","_score": 0.6511617,"_source": {"id": 4,"title": "三毛逝世30周年丨一场与三毛穿越时空的对话","uv": 150,"create_date": "2024-01-16","status": 1,"remark": "来源澎湃新闻"},"highlight": {"title": ["<b>三毛</b>逝世30周年丨<b>一</b>场与<b>三毛</b>穿越时空的对话"]}},{"_index": "ik_news","_type": "_doc","_id": "7","_score": 0.55606395,"_source": {"id": 7,"title": "三毛的英文名为什么叫Echo?","uv": 300,"create_date": "2024-01-21","status": 1,"remark": "来源百度知道"},"highlight": {"title": ["<b>三毛</b>的英文名为什么叫Echo?"]}},{"_index": "ik_news","_type": "_doc","_id": "6","_score": 0.5000325,"_source": {"id": 6,"title": "超全整理!三毛最出名的11本著作,没读过的一定要看看","uv": 200,"create_date": "2024-01-23","status": 1,"remark": "来源知乎搜索"},"highlight": {"title": ["超全整理!<b>三毛</b>最出名的11本著作,没读过的<b>一</b>定要看看"]}},{"_index": "ik_news","_type": "_doc","_id": "8","_score": 0.45885387,"_source": {"id": 8,"title": "毛国家统计局发布第三季度贸易数据","uv": 50,"create_date": "2024-01-23","status": 1,"remark": "来源中华人民共和国商务部"},"highlight": {"title": ["<b>毛</b>国家统计局发布第<b>三</b>季度贸易数据"]}},{"_index": "ik_news","_type": "_doc","_id": "9","_score": 0.42383182,"_source": {"id": 9,"title": "网易公布2022年第三季度财报|净收入|毛利润","uv": 131,"create_date": "2024-01-22","status": 1,"remark": "来源网易科技"},"highlight": {"title": ["网易公布2022年第<b>三</b>季度财报|净收入|<b>毛</b>利润"]}},{"_index": "ik_news","_type": "_doc","_id": "10","_score": 0.09917182,"_source": {"id": 10,"title": "单季盈利超100亿元!比亚迪三季度毛利率超特斯拉","uv": 310,"create_date": "2024-01-23","status": 1,"remark": "来源新浪财经"},"highlight": {"title": ["单季盈利超100亿元!比亚迪<b>三</b>季度毛利率超特斯拉"]}}]}
}

pinyin分词器

创建索引pinyin_news

PUT {{domain}}/pinyin_news# 创建参数
{"settings": {"index": {"number_of_shards": "5","number_of_replicas": "1"},"analysis": {"analyzer": {"default": {# 拼音分词器默认名称"type": "pinyin"}}}},"mapping": {"_doc": {"properties": {"id": {"type": "long"},"title": {"type": "text","analyzer": "pinyin"},"uv": {"type": "long"},"create_date": {"type": "date"},"status": {"type": "int"},"remark": {"type": "text","analyzer": "pinyin"}}}}
}

插入模拟数据

        (略)数据内容同上,除索引名称、分词器不一样外,其他一样。

查询,返回通过分词查询到的结果、高亮的分词

请求查询的命令:

POST {{domain}}/pinyin_news/_search# 查询参数,pingyin{"query": {"bool": {"must": {"match": {# 查询参数写拼音,也能查到title字段是汉字的结果"title": "sanmao woyuanyishengliulang tiancaizuojia"}}}},"highlight": {"fields": {"remark": {},"title": {}},"number_of_fragments": 0,"post_tags": ["</b>"],"pre_tags": ["<b>"],"require_field_match": false,"type": "plain"},"from": 0,"size": 10000,"sort": [],"aggs": {}
}

分词查询结果:
        通过拼音同样能查询到es中的中文记录,但是,pinyin分词对高亮结果的返回可能不太支持,全部都是空标签。

{"took": 123,"timed_out": false,"_shards": {"total": 5,"successful": 5,"skipped": 0,"failed": 0},"hits": {"total": 10,"max_score": 6.046854,"hits": [{"_index": "pinyin_news","_type": "_doc","_id": "2","_score": 6.046854,"_source": {"id": 2,"title": "我愿一生流浪 | 三毛《撒哈拉的故事","uv": 99,"create_date": "2024-01-14","status": 1,"remark": "来源知乎搜索"},"highlight": {"remark": ["<b></b>来源知乎搜索"],"title": ["<b></b><b></b><b></b><b></b><b></b><b></b><b></b><b></b>我愿一生流浪 | 三毛《撒哈拉的故事"]}},{"_index": "pinyin_news","_type": "_doc","_id": "5","_score": 4.6167893,"_source": {"id": 5,"title": "三毛:从自闭少女到天才作家","uv": 141,"create_date": "2024-01-18","status": 1,"remark": "来源光明网"},"highlight": {"remark": ["<b></b>来源光明网"],"title": ["<b></b><b></b><b></b><b></b><b></b><b></b>三毛:从自闭少女到天才作家"]}},{"_index": "pinyin_news","_type": "_doc","_id": "1","_score": 1.7759907,"_source": {"id": 1,"title": "三毛:她把短暂的一生,活成了十世","uv": 120,"create_date": "2024-01-15","status": 1,"remark": "来源百度搜索"},"highlight": {"remark": ["<b></b>来源百度搜索"],"title": ["<b></b><b></b><b></b><b></b>三毛:她把短暂的一生,活成了十世"]}},{"_index": "pinyin_news","_type": "_doc","_id": "10","_score": 1.6479323,"_source": {"id": 10,"title": "单季盈利超100亿元!比亚迪三季度毛利率超特斯拉","uv": 310,"create_date": "2024-01-23","status": 1,"remark": "来源新浪财经"},"highlight": {"remark": ["<b></b><b></b><b></b>来源新浪财经"],"title": ["<b></b><b></b><b></b><b></b>单季盈利超100亿元!比亚迪三季度毛利率超特斯拉"]}},{"_index": "pinyin_news","_type": "_doc","_id": "3","_score": 1.4564657,"_source": {"id": 3,"title": "离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!","uv": 80,"create_date": "2024-01-15","status": 1,"remark": "来源搜狐"},"highlight": {"remark": ["<b></b>来源搜狐"],"title": ["<b></b><b></b><b></b><b></b><b></b>离世33年仍是“华语顶流”,三毛“珍贵录音”揭露人生真相:世界是对的,但我也没错!"]}},{"_index": "pinyin_news","_type": "_doc","_id": "8","_score": 1.352735,"_source": {"id": 8,"title": "毛国家统计局发布第三季度贸易数据","uv": 50,"create_date": "2024-01-23","status": 1,"remark": "来源中华人民共和国商务部"},"highlight": {"remark": ["<b></b>来源中华人民共和国商务部"],"title": ["<b></b><b></b><b></b><b></b><b></b>毛国家统计局发布第三季度贸易数据"]}},{"_index": "pinyin_news","_type": "_doc","_id": "6","_score": 1.3015552,"_source": {"id": 6,"title": "超全整理!三毛最出名的11本著作,没读过的一定要看看","uv": 200,"create_date": "2024-01-23","status": 1,"remark": "来源知乎搜索"},"highlight": {"remark": ["<b></b>来源知乎搜索"],"title": ["<b></b><b></b><b></b><b></b>超全整理!三毛最出名的11本著作,没读过的一定要看看"]}},{"_index": "pinyin_news","_type": "_doc","_id": "9","_score": 1.2533218,"_source": {"id": 9,"title": "网易公布2022年第三季度财报|净收入|毛利润","uv": 131,"create_date": "2024-01-22","status": 1,"remark": "来源网易科技"},"highlight": {"remark": ["<b></b><b></b>来源网易科技"],"title": ["<b></b><b></b><b></b><b></b>网易公布2022年第三季度财报|净收入|毛利润"]}},{"_index": "pinyin_news","_type": "_doc","_id": "4","_score": 0.5007427,"_source": {"id": 4,"title": "三毛逝世30周年丨一场与三毛穿越时空的对话","uv": 150,"create_date": "2024-01-16","status": 1,"remark": "来源澎湃新闻"},"highlight": {"remark": ["<b></b>来源澎湃新闻"],"title": ["<b></b><b></b><b></b><b></b><b></b>三毛逝世30周年丨一场与三毛穿越时空的对话"]}},{"_index": "pinyin_news","_type": "_doc","_id": "7","_score": 0.3807567,"_source": {"id": 7,"title": "三毛的英文名为什么叫Echo?","uv": 300,"create_date": "2024-01-21","status": 1,"remark": "来源百度知道"},"highlight": {"remark": ["<b></b>来源百度知道"],"title": ["<b></b><b></b>三毛的英文名为什么叫Echo?"]}}]}
}

参考链接

  1. ElasticSearch 的使用-高亮查询
  2. 使用Postman操作es的_bulk批量导入操作_es批量 _bulk postman-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/654136.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

DMA 和 零拷贝技术 到 网络大文件传输优化

文章目录 DMA 控制器的发展无 DMA 控制器 IO 过程DMA 控制器 传统文件传输性能有多糟糕&#xff1f;如何优化文件传输性能零拷贝技术mmap writesendfileSG-DMA&#xff08;The Scatter-Gather Direct Memory Access&#xff09; 零拷贝技术的应用 大文件传输应该用什么方式Pag…

后台管理系统模板搭建/项目配置

1 项目初始化 一个项目要有统一的规范&#xff0c;需要使用eslintstylelintprettier来对我们的代码质量做检测和修复&#xff0c;需要使用husky来做commit拦截&#xff0c;需要使用commitlint来统一提交规范&#xff0c;需要使用preinstall来统一包管理工具。 1.1 环境准备 1…

idea 创建 spring boot

1.创建步骤 2. 编码添加 2.1 这是自动生成的启动函数 package com.example.comxjctest4;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;SpringBootApplication public class Application {publi…

MySql的使用方法

一.什么是MySql MySql是一种数据库管理系统&#xff0c;是用来存储数据的&#xff0c;可以有效的管理数据&#xff0c;数据库的存储介质为硬盘和内存。 和文件相比&#xff0c;它具有以下优点&#xff1a; 文件存储数据是不安全的&#xff0c;且不方便数据的查找和管理&#xf…

【3分钟开服】幻兽帕鲁服务器一键部署保姆教程,PalWorld开服联机教程

在帕鲁的世界&#xff0c;你可以选择与神奇的生物「帕鲁」一同享受悠闲的生活&#xff0c;也可以投身于与偷猎者进行生死搏斗的冒险。帕鲁可以进行战斗、繁殖、协助你做农活&#xff0c;也可以为你在工厂工作。你也可以将它们进行售卖&#xff0c;或肢解后食用。 想要部署属于自…

从零开发短视频电商 Tesseract OCR识别增强

文章目录 概要图像预处理阶段默认反转图像重新缩放二值化噪音消除膨胀/腐蚀旋转/偏移校正边框缺少边框边框太大扫描边框去除 透明度/Alpha通道 引擎处理阶段语言模型配置提高识别速度词典、单词列表和模式表格识别 使用 Tesseract OCR 的 GUI 和其他项目 原文如下&#xff1a; …

TypeScript实战系列之合理运用类型

目录 介绍any 和 unknownerve 的用途断言type 和 interfacedeclare 关键字的作用联合类型 和 类型守卫交叉类型 介绍 这篇主要介绍下ts 常用的基本类型和一些常用的技巧性技能 any 和 unknow any 和 unknown 是两个类型关键字&#xff0c;它们用于处理类型不确定或未知的情况…

【Sql Server】新手一分钟看懂在已有表基础上修改字段默认值和数据类型

欢迎来到《小5讲堂》&#xff0c;大家好&#xff0c;我是全栈小5。 这是《Sql Server》系列文章&#xff0c;每篇文章将以博主理解的角度展开讲解&#xff0c; 特别是针对知识点的概念进行叙说&#xff0c;大部分文章将会对这些概念进行实际例子验证&#xff0c;以此达到加深对…

力扣日记1.28-【回溯算法篇】93. 复原 IP 地址

力扣日记&#xff1a;【回溯算法篇】93. 复原 IP 地址 日期&#xff1a;2023.1.28 参考&#xff1a;代码随想录、力扣 93. 复原 IP 地址 题目描述 难度&#xff1a;中等 有效 IP 地址 正好由四个整数&#xff08;每个整数位于 0 到 255 之间组成&#xff0c;且不能含有前导 0&…

IP地址定位技术的巧妙运用:企业网络安全的坚实防线

在当今数字时代&#xff0c;企业网络安全成为了至关重要的议题。面对不断增长的网络威胁&#xff0c;企业不得不采用创新性技术来保护其机密信息和关键系统。IP地址定位技术作为一种强大的工具&#xff0c;为企业提供了一种新颖而高效的网络安全保护手段。 IP地址定位技术简介 …

前端Vue v-for 的使用

目录 ​编辑 简介 使用方式 基本使用 v-for"(item, index)中item和index作用 示例 迭代对象 示例 结果 前言-与正文无关 生活远不止眼前的苦劳与奔波&#xff0c;它还充满了无数值得我们去体验和珍惜的美好事物。在这个快节奏的世界中&#xff0c;我们往往容易陷入…

证券公司怎么选择?福州开股票账户佣金最低是多少?怎么开低佣金账户?

股票交易佣金是指投资者在进行股票交易时&#xff0c;需要向券商支付的手续费。具体的佣金费用根据券商的政策而有所不同&#xff0c;一般分为固定佣金和按比例佣金两种方式。 固定佣金是指交易每一笔固定收取一定金额的佣金&#xff0c;通常适用于较小交易量的投资者&#xf…

github ssh ssh-keygen

生成和使用 SSH 密钥对是一种安全的身份验证方式&#xff0c;用于在你的本地系统和 GitHub 之间进行身份验证。以下是在 GitHub 上生成和使用 SSH 密钥对的基本步骤&#xff1a; 1. 生成 SSH 密钥对 在命令行中执行以下命令来生成 SSH 密钥对&#xff1a; ssh-keygen -C &q…

ATT汇编

指令后缀 AT&T格式的汇编指令有不同的后缀 其中 b表示byte&#xff0c;字节 w表示word&#xff0c;字/两字节 l表示long&#xff0c;32位系统下的long是4字节 q表示quad&#xff0c;意味四重&#xff0c;表示4个字/8字节 寄存器用途 参见 AT&T的汇编世界 - Gemfield…

把数组中的key都取出来然后去重

今日接到一个小需求&#xff0c;一张表有类似这样的数据&#xff1a;&#xff08;下面是一行&#xff09; 但是每行的数据&#xff0c;主要是key不一样&#xff0c;我们想把所有的key取出来&#xff0c;并且做个去重。 首先我先在mysql中&#xff0c; SELECT GROUP_CONCAT(RE…

蓝桥杯---九数组分数

1,2,3 ... 9 这九个数字组成一个分数,其值恰好为1/3,如何组法? 下面的程序实现了该功能,请填写划线部分缺失的代码。 注意,只能填写缺少的部分,不要重复抄写已有代码。不要填写任何多余的文字。 代码 public class _05九数组分数 {public static void test(int[] x){int a …

Linux, Certbot快速申请免费https证书

linux环境. 更新apt,为了能正确的下载certbot apt update 安装certbot apt install certbot 如果之前nginx已经开启着了,先关掉,防止端口占用 nginx -s stop 运行certbot开始获取证书文件 certbot certonly 输入1直接回车,意思就是让certbot模拟一个web服务器执行下面的…

探秘Photoshop | 一站式了解所有相关信息

Photoshop是迄今为止世界上最强大的图像编辑软件&#xff0c;它已成为许多涉及图像处理的行业标准。软件技术一天行千里&#xff0c; Photoshop也在不断更新&#xff0c;从1990年开始发布&#xff0c; photoshop1.0到最新的 2018Photoshop... 几乎每隔一年&#xff0c;Photosho…

Apache 辅助系统工具

一丶Apache Sqoop 1.Sqoop的介绍&#xff1a; Sqoop的工作机制是将导入或者导出的命令翻译成MapReduce实现&#xff0c;Sqoop可以理解为&#xff1a;SQL到Hadoop或者Hadoop到SQL 2.Sqoop的安装 配置文件修改&#xff1a; cd $SQOOP_HOME/conf mv sqoop-env-template.sh sqo…

Dubbo Consumer 对Provider的protocol选择逻辑

一、简介 dubbo consumer 如果没有指定protocol参数&#xff0c;默认会将provider注册的protocol provider url都获取并转换为Invoker放到Directory中。如果consumer指定了protocol则会在Directory中选择相应的protocol provider url转换为Invoker放在Directory中。 二、代码分…