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.rhkb.cn/news/247400.html

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

相关文章

What is Rust? Why Rust?

why Rust&#xff1f; 目前&#xff0c;Rust 变得越来越流行。然而&#xff0c;仍然有很多人&#xff08;和公司&#xff01;&#xff09;误解了 Rust 的主张价值是什么&#xff0c;甚至误解了它是什么。在本文中&#xff0c;我们将讨论 Rust 是什么以及为什么它是一种可以增强…

laravel框架项目对接小程序实战经验回顾

一.对接小程序总结 1.状态转换带来的问题&#xff0c;如下 问题原因&#xff1a;由于status 传参赋值层级较多&#xff0c;导致后续查询是数组但是传参是字符串&#xff0c; 解决方案&#xff1a;互斥的地方赋值为空数组&#xff0c;有状态冲突的地方unset掉不需要的参数 2参…

【数字电子技术课程设计】多功能数字电子钟的设计

目录 摘要 1 设计任务要求 2 设计方案及论证 2.1 任务分析 2.1.1 晶体振荡器电路 2.1.2 分频器电路 2.1.3 时间计数器电路 2.1.4 译码驱动电路 2.1.5 校时电路 2.1.6 整点报时/闹钟电路 2.2 方案比较 2.3 系统结构设计 2.4 具体电路设计 3 电路仿真测试及结…

华为产业链之车载激光雷达

一、智能汽车 NOA 加快普及&#xff0c;L3 上路利好智能感知硬件 1、感知层是 ADAS 最重要的一环 先进驾驶辅助系统 &#xff08;ADAS&#xff0c; Advanced driver-assistance system&#xff09;分“感知层、决策层、执行层”三个层级&#xff0c;其中感知层是最重要的一环…

初探二分法

推荐阅读 智能化校园&#xff1a;深入探讨云端管理系统设计与实现&#xff08;一&#xff09; 智能化校园&#xff1a;深入探讨云端管理系统设计与实现&#xff08;二&#xff09; 文章目录 推荐阅读题目解法一解法二 题目 题目&#xff1a;给定一个 n 个元素有序的&#xff0…

Windows 和 Anolis 通过 Docker 安装 Milvus 2.3.4

Windows 10 通过 Docker 安装 Milvus 2.3.4 一.Windows 安装 Docker二.Milvus 下载1.下载2.安装1.Windows 下安装&#xff08;指定好Docker文件目录&#xff09;2.Anolis下安装 三.数据库访问1.ATTU 客户端下载 一.Windows 安装 Docker Docker 下载 双击安装即可&#xff0c;安…

面经基础版案例(路由,请求渲染,传参,组件缓存)

文章目录 1.案例效果分析2.配置一级路由&#xff08;首页&#xff0c;详情&#xff09;3.配置二级路由4.导航高亮效果5.首页的请求渲染6.传参&#xff08;查询参数 $ 动态路由&#xff09;7.详情页渲染8.组件缓存kepp-alive9.总结 1.案例效果分析 2.配置一级路由&#xff08;首…

IDEA开发使用 thymeleaf 模板$表达式报红波浪线解决方案

系列文章目录 文章目录 系列文章目录后端存值前端取值thymeleaf 后端存值 RequestMapping("/testModelAndView")//使用ModelAndView时返回的方法类型必须是ModelAndViewpublic ModelAndView testModelAndView() {//创建ModelAndView对象ModelAndView mav new Model…

借用GitHub将typora图片文件快速上传CSDN

前情概要 众所周知&#xff0c;程序员大佬们喜欢用typora软件写代码笔记&#xff0c;写了很多笔记想要放到CSDN上给其他大佬分享&#xff0c;但是在往csdn上搬运的时候&#xff0c;图片总是上传出错&#xff0c;一张一张搞有很麻烦&#xff0c;咋如何搞&#xff1f; 废话不多…

java数据结构与算法刷题-----LeetCode769. 最多能完成排序的块

java数据结构与算法刷题目录&#xff08;剑指Offer、LeetCode、ACM&#xff09;-----主目录-----持续更新(进不去说明我没写完)&#xff1a;https://blog.csdn.net/grd_java/article/details/123063846 解题思路 这道题可以理解为&#xff0c;只能保证块内有序的情况下&#xf…

ArcgisForJs快速入门

文章目录 0.引言1.前端代码编辑工具2.使用ArcgisForJs创建一个简单应用3.切片地图服务图层4.动态地图服务图层5.地图事件 0.引言 ArcGIS API for JavaScript是一款由Esri公司开发的用于创建WebGIS应用的JavaScript库。它允许开发者通过调用ArcGIS Server的REST API&#xff0c…

探索Viper-适用于GoLang的完整配置解决方案

前言 对于现代应用程序&#xff0c;尤其大中型的项目来说&#xff0c;在程序启动和运行时&#xff0c;往往需要传入许多参数来控制程序的行为&#xff0c;我们可以通过命令行参数&#xff0c;环境变量&#xff0c;配置文件等方式来将参数传递给程序。而Viper库为Golang语言开发…

Flink问题解决及性能调优-【Flink不同并行度引起sink2es报错问题】

最近需求&#xff0c;仅想提高sink2es的qps&#xff0c;所以仅调节了sink2es的并行度&#xff0c;但在调节不同算子并行度时遇到一些问题&#xff0c;找出问题的根本原因解决问题&#xff0c;并分析整理。 实例代码 --SET table.exec.state.ttl86400s; --24 hour,默认: 0 ms …

centos 7安装MySQl

本文参考借鉴&#xff1a;https://cloud.tencent.com/developer/article/2353312&#xff0c;非常赞&#xff01; 为了避免权限不足的问题&#xff0c;建议切换至root用户进行安装 1.MySQL的清理与安装 查看是否存在MySQL服务 安装mysql之前&#xff0c;需要先看看要安装系…

基于springboot宠物领养系统

摘要 随着社会的不断发展和人们生活水平的提高&#xff0c;宠物在家庭中的地位逐渐上升&#xff0c;宠物领养成为一种流行的社会现象。为了更好地管理和促进宠物领养的过程&#xff0c;本文基于Spring Boot框架设计和实现了一套宠物领养系统。该系统以用户友好的界面为特点&…

选择合适的CRM管理系统,需要满足以下条件

随着数据时代的发展和企业业务的不断扩大&#xff0c;数据的比例开始增加&#xff0c;传统的数据计算方法不再适合现代企业。客户管理已成为企业最重要的组成部分之一&#xff0c;越来越多的企业开始关注客户管理。在crm管理系统上&#xff0c;企业希望通过crm管理系统&#xf…

第一节课,用户管理--后端初始化,项目调通。二次翻工

一、代码下载 网址&#xff1a; 用户管理第一节课&#xff0c;阿里生成代码包-CSDN博客 二、项目步骤&#xff0c;参考从 网址&#xff1a; 一、第一节课&#xff0c;用户管理--后端初始化&#xff0c;项目调通-CSDN博客 从这里开始跟随 &#xff08;一&#xff09;、跟随…

爬虫基础-前端基础

Html是骨骼、css是皮肤、js是肌肉&#xff0c;三者之间的关系可以简单理解为m(html)-v(css)-c(js) 浏览器的加载过程 构建dom树 子资源加载-加载外部的css、图片、js等外部资源 样式渲染-css执行 DOM树 ajax、json、xml AJAX 是一种在无需重新加载整个网页的情况下&#xf…

简述云原生基础定义及关键技术

云原生是什么 云原生是面向“云”而设计的应用,因此技术部分依赖于传统云计算的 3 层概念,基础设施即服务(IaaS)、平台即服务(PaaS)和软件即服务(SaaS)。 例如,敏捷的不可变基础设施交付类似于 IaaS,用来提供计算网络存储等基础资源,这些资源是可编程且不可变的,直…

【Java与网络6】实现一个自己的HTTP浏览器

前面我们讨论了HTTP协议的基本结构和Socket编程的基本原理&#xff0c;本文我们来整个大活&#xff1a;自己实现一个简单的浏览器。 目录 1.主线程循环体 2.readHostAndPort()方法的实现 3.readHttpRequest()方法的实现 4.sendHttpRequest()方法的实现 5.readHttpRespons…