ElasticSearch学习篇2_Rest格式操作(索引、文档)、文档的简单操作(增、删、改、查)、复杂查询操作(排序、分页、高亮)_scl、的博客-CSDN博客


本站和网页 https://blog.csdn.net/qq_24654501/article/details/118877744 的作者无关,不对其内容负责。快照谨为网络故障时之索引,不代表被搜索网站的即时页面。

ElasticSearch学习篇2_Rest格式操作(索引、文档)、文档的简单操作(增、删、改、查)、复杂查询操作(排序、分页、高亮)_scl、的博客-CSDN博客
ElasticSearch学习篇2_Rest格式操作(索引、文档)、文档的简单操作(增、删、改、查)、复杂查询操作(排序、分页、高亮)
scl、
于 2021-07-18 18:29:43 发布
1619
收藏
分类专栏:
# ElasticSearch
文章标签:
ElasticSearch
ES
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_24654501/article/details/118877744
版权
ElasticSearch
专栏收录该内容
4 篇文章
0 订阅
订阅专栏
目录
关于索引的基本操作
声明索引、字段类型获取索引信息举栗删除索引举栗拓展命令 关于文档的基本操作
插入文档删除文档修改文档获取文档
根据id获取根据条件获取带json参数体的查询(单字段查询)带json参数体的查询(多字段查询)带json参数体的过滤显示字段带json参数体的过滤范围查询排序分页匹配多个查询条件精确查询高亮查询
一、关于索引的基本操作
1.声明索引、字段类型
1.字段类型
字符串类型:text、keyword数值类型:long、integer、short、byte、double、float、half、scaled float日期类型:date布尔类型值:boolean二进制类型:binary…
2.索引、字段类型创建举栗
================ PUT ===============
PUT /test
"mappings": {
"properties": {
"name" : {
"type": "text"
},
"age":{
"type": "long"
},
"birthday":{
"type": "date"
============= 输出结果 =================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "test"
3.获取索引信息举栗
=========== Get 索引、文档 ==========
GET user
=========== 结果输出 ==============
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"user" : {
"aliases" : { },
"mappings" : {
"properties" : {
"age" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
},
"number_of_shards" : "1",
"provided_name" : "user",
"creation_date" : "1626593203604",
"number_of_replicas" : "1",
"uuid" : "9yJCbj-KSpmh_GiqZNhlSw",
"version" : {
"created" : "7130399"
4.删除索引举栗
=============== DELETE =================
DELETE test
================ 输出结果 ================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"acknowledged" : true
5.拓展命令
GET _cat/health查看集群健康状态GET _cat/indices?v 查看索引及其相关信息
二、关于文档的基本操作
基本操作格式
1.插入文档
1.直接指定id插入文档举栗
PUT /索引名/类型名/ 文档id
=============== PUT ===================
PUT /user/type1/1 // 类型名type在8.x版本之后废弃,默认为_doc类型
"name" : "xiaosi",
"age" : "20"
================ 输出结果 ================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
"_index" : "user",
"_type" : "type1",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
2.只插入文档,没有指定字段类型,默认配置字段类型举栗
============= PUT /索引/_doc/文档id ==================
PUT /test2/_doc/1
"name" : "xiaosi",
"age" : "20",
"birthday":"2001-09-06"
=================== 输出结果 ====================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"_index" : "test2",
"_type" : "_doc",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
======================== GET test2 =========================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"test2" : {
"aliases" : { },
"mappings" : {
"properties" : {
"age" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"birthday" : {
"type" : "date" ==========>自动补充类型为date
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
},
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
},
"number_of_shards" : "1",
"provided_name" : "test2",
"creation_date" : "1626594849533",
"number_of_replicas" : "1",
"uuid" : "m6fYbqMlQrCc7e7Mzs2e5w",
"version" : {
"created" : "7130399"
2.删除文档
=========== DELETE ==============
DELETE /user/type1/1
============== 输出结果 ============
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in document index requests is deprecated, use the /{index}/_doc/{id} endpoint instead.
"_index" : "user",
"_type" : "type1",
"_id" : "1",
"_version" : 2,
"result" : "deleted",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 1,
"_primary_term" : 1
3.修改文档
1.根据id使用PUT更新文档举栗
=============== PUT ===================
PUT /test2/_doc/1
"name" : "更新之后的xiaosi",
"age" : "20",
"birthday":"2001-09-06"
=============== 输出结果 =========================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"_index" : "test2",
"_type" : "_doc",
"_id" : "1",
"_version" : 2, ========> 更新一次virsion + 1
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 1,
"_primary_term" : 1
2.POST方式、_update 更新文档举栗
============ POST ==================
POST /test2/_doc/1/_update
"doc":{
"name" : "POST更新之后的xiaosi"
============= 输出结果 ===================
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in document update requests is deprecated, use the endpoint /{index}/_update/{id} instead.
"_index" : "test2",
"_type" : "_doc",
"_id" : "1",
"_version" : 3,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 2,
"_primary_term" : 1
4.获取文档
1.根据id获取文档
=========== GET ============
GET /user/_doc/4
=========== 输出 ============
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
"_index" : "user",
"_type" : "_doc",
"_id" : "4",
"_version" : 1,
"_seq_no" : 3,
"_primary_term" : 1,
"found" : true,
"_source" : {
"name" : "朱丹",
"age" : 25,
"salary" : 60000000,
"tags" : [
"没带脑子",
"英语",
"主持人"
],
"desc" : "骚凹瑞~娜扎?热巴,巴斯特贝斯特,则沃德,虫害!!!"
2.简单条件查询
GET /user/_doc/_search?q=name:xiaosi
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 116,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.6277175,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.6277175,
"_source" : {
"name" : "xiaosi",
"age" : 20,
"salary" : 20000,
"tags" : [
"程序员",
"宅",
"格子衫"
],
"desc" : "总结6点......"
3.带json参数体的查询(单字段查询)
GET /user/_doc/_search
"query":{
"match":{
"name":"迪丽热巴"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 7,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 4.0607862,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "2",
"_score" : 4.0607862,
"_source" : {
"name" : "迪丽热巴",
"age" : 22,
"salary" : 20000000,
"tags" : [
"女神",
"漂亮",
"新疆"
],
"desc" : "1111"
查出结果为两个
GET /user/_doc/_search
"query":{
"match":{
"name":"朱"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 169,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : { ==========》 hits 索引和文档的信息
"total" : {
"value" : 2, ========》查询结果数量
"relation" : "eq"
},
"max_score" : 1.0137007, ========》最大匹配分数
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.0137007,
"_source" : {
"name" : "朱丹",
"age" : 25,
"salary" : 60000000,
"tags" : [
"没带脑子",
"英语",
"主持人"
],
"desc" : "骚凹瑞~娜扎?热巴,巴斯特贝斯特,则沃德,虫害!!!"
},
"_index" : "user",
"_type" : "_doc",
"_id" : "5",
"_score" : 0.77041256,
"_source" : {
"name" : "朱丹2号",
"age" : 2,
"salary" : 60000000,
"tags" : [
"英语",
"主持人"
],
"desc" : "团听耐听,虫害!!!"
4.带json参数体的查询(多字段查询)
======================= 1. must(and)、must_not(not) ========================
GET /user/_doc/_search
"query":{
"bool":{
"must":[
// 条件1
"match":{
"name":"xiaosi"
// 条件2
"match":{
"age":20
},
"_source":["name","desc"],
"sort": [
"age":{
"order":"desc"
],
"from" :0,
"size": 1
======================= 2. should(or) ========================
GET /user/_doc/_search
"query":{
"bool":{
"should":[
"match":{"name":"xiaosi"}
"match":{"age":21 }
},
"_source":["name","desc"],
"sort": [
"age":{
"order":"desc"
],
"from" :0,
"size": 1
4.带json参数体的过滤显示字段
GET /user/_doc/_search
"query":{
"match":{
"name":"朱"
},
"_source":["name","desc"]
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0137007,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.0137007,
"_source" : {
"name" : "朱丹",
"desc" : "骚凹瑞~娜扎?热巴,巴斯特贝斯特,则沃德,虫害!!!"
},
"_index" : "user",
"_type" : "_doc",
"_id" : "5",
"_score" : 0.77041256,
"_source" : {
"name" : "朱丹2号",
"desc" : "团听耐听,虫害!!!"
5.带json参数体的过滤范围查询
gt >gte >=lt <lte <=
GET /user/_doc/_search
"query":{
"bool":{
// and
"must":[
// 条件
"match":{"name":"朱"}
],
// 过滤
"filter":{
"range":{
"age":{
"lt": 20,
"gte":10
},
"_source":["name","age"],
"sort": [
"age":{
"order":"desc"
6.排序
GET /user/_doc/_search
"query":{
"match":{
"name":"朱"
},
"_source":["name","desc"],
"sort": [
"age":{
"order":"desc"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "4",
"_score" : null,
"_source" : {
"name" : "朱丹",
"desc" : "骚凹瑞~娜扎?热巴,巴斯特贝斯特,则沃德,虫害!!!"
},
"sort" : [
25
},
"_index" : "user",
"_type" : "_doc",
"_id" : "5",
"_score" : null,
"_source" : {
"name" : "朱丹2号",
"desc" : "团听耐听,虫害!!!"
},
"sort" : [
7.分页
from从哪个文档开始size获取文档数量
GET /user/_doc/_search
"query":{
"match":{
"name":"朱"
},
"_source":["name","desc"],
"sort": [
"age":{
"order":"desc"
],
"from" :0,
"size": 1
8.匹配多个查询条件
GET /user/_doc/_search
"query":{
"bool":{
"must":[
"match":{"tags":"团"} // tags为字符串数组,单个字也能匹配其中的 字符串,多个字 使用空格隔开可以匹配数组中多个
],
"filter":{
"range":{
"age":{
"lt": 100
},
"_source":["name","tags"],
"sort": [
"age":{
"order":"desc"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "3",
"_score" : null,
"_source" : {
"name" : "古力娜扎",
"tags" : [
"娜扎",
"虫害",
"团听耐听"
},
"sort" : [
23
GET /user/_doc/_search
"query":{
"bool":{
"must":[
"match":{"tags":"程 主"}
],
"filter":{
"range":{
"age":{
"lt": 100
},
"_source":["name","tags"],
"sort": [
"age":{
"order":"desc"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 3,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "4",
"_score" : null,
"_source" : {
"name" : "朱丹",
"tags" : [
"没带脑子",
"英语",
"主持人"
},
"sort" : [
25
},
"_index" : "user",
"_type" : "_doc",
"_id" : "1",
"_score" : null,
"_source" : {
"name" : "xiaosi",
"tags" : [
"程序员",
"宅",
"格子衫"
},
"sort" : [
20
},
"_index" : "user",
"_type" : "_doc",
"_id" : "5",
"_score" : null,
"_source" : {
"name" : "朱丹2号",
"tags" : [
"英语",
"主持人"
},
"sort" : [
9.精确查询
关于分词存储
term,直接查询精确的match,会使用分词器解析
两个字段类型
keyword:term下不会被分词解析,如查 迪丽热巴,查询 热巴 则无结果。而且使用分词器也不会被分词为单个的字。text:term下会被分词解析,如查 迪丽热巴,查询 热巴 也有结果。使用分词器会被分词为单个的字。
GET /user/_doc/_search
"query":{
"bool":{
"should":[
"term":{"name":"xiaosi"}
},
"term":{"age": "20"}
],
"filter":{
"range":{
"age":{
"lt": 100
},
"_source":["name","tags"],
"sort": [
"age":{
"order":"desc"
10.高亮查询
GET /user/_doc/_search
"query":{
"bool":{
"must":[
"term":{"name":"xiaosi"}
],
"filter":{
"range":{
"age":{
"lt": 100
},
"highlight":{ ============> 加高亮
"fields":{
"name":{}
},
"_source":["name","tags"],
"sort": [
"age":{
"order":"desc"
#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
#! [types removal] Specifying types in search requests is deprecated.
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : null,
"hits" : [
"_index" : "user",
"_type" : "_doc",
"_id" : "1",
"_score" : null,
"_source" : {
"name" : "xiaosi",
"tags" : [
"程序员",
"宅",
"格子衫"
},
"highlight" : {
"name" : [
"<em>xiaosi</em>" ======⇒ 查询结果自动加上了 <em> 标签
},
"sort" : [
20
另外还可以自己指定高亮样式
前缀"pre_tags":"<p class='key style='color:red'>",后缀 "post_tags":"</p>",
scl、
关注
关注
点赞
收藏
打赏
评论
ElasticSearch学习篇2_Rest格式操作(索引、文档)、文档的简单操作(增、删、改、查)、复杂查询操作(排序、分页、高亮)
目录关于索引的基本操作关于文档的基本操作一、关于索引的基本操作1.声明索引、字段类型1.字段类型字符串类型:text、keyword数值类型:long、integer、short、byte、double、float、half、scaled float日期类型:date布尔类型值:boolean二进制类型:binary…2.索引、字段类型创建举栗================ PUT ===============PUT /test{ "mappings": {
复制链接
扫一扫
专栏目录
禁用Kibana安全提示(Elasticsearch built-in security features are not enabled)
子冉冰清的博客
03-05
6077
禁用Kibana安全提示(Elasticsearch built-in security features are not enabled)
Kibana提示#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearc
Elasticsearch built-in security features are not enabled去除
自行车的博客
01-31
4255
查询的时候有这个错误,很不习惯
在个人学习或者内网开放ES+VPN连接的情况下我们完全不需要开启安全功能,其他情况在生产集群中还是建议开启安全选项的。因此,这里将他关闭先
在elasticsearch.yml 配置禁用安全选项xpack.security.enabled,之后重启ElasticSearch即可:
xpack.security.enabled: false
重启即可
参考
禁用Kibana安全提示(Elasticsearch built-in security features are n
评论 1
您还未登录,请先
登录
后发表或查看评论
REST风格
最新发布
maohe的博客
10-31
218
REST其实就是资源访问路径的一种格式。也可以当成对资源访问路径的书写规范。之所以说是可以当成,其实REST并不称自己是一种规范而是风格,因为REST刚出来的时候,使用者还不习惯REST风格的写法, 到后来大家都觉得REST风格书写简便,大家都默默规定了这种书写形式。所有可以说是可以当成一种规范来看待。:根据REST规定的形式书写访问路径,书写更简单,访问信息更隐蔽。
Elasticsearch7.17学习笔记
qq_60695343的博客
10-17
128
Elasticsearch的常见参数、常用语法、请求结构解释。非常适合刚接触ES的人观看,快速入门。
Elasticsearch报错Elasticsearch built-in security features are not enabled
邓邓子的博客
03-27
5104
目录一、问题描述二、解决方法
一、问题描述
SpringBoot 集成 Elasticsearch 时报错 Elasticsearch built-in security features are not enabled:
2022-03-25 18:23:50.589 WARN 58032 --- [/O dispatcher 1] org.elasticsearch.client.RestClient : request [GET http://192.168.1.38:9200/] re
Elasticsearch的RESTful API
zyy247796143的博客
05-25
393
接上一篇搭建文章中,nginx.conf 定义的log格式是:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
实际的nginx日志实例
elasticsearch学习
Hero_孙的博客
08-02
624
kibana
创建索引
put /索引名/类型名/id
PUT /test/type/1
"name": "shj",
"age": 5
创建索引规格
PUT /shj
"mappings": {
"properties": {
"name":{
"type": "text"
},
"age":{
"type": "long"
},
"birthday":{
elasticsearch7使用指导
古月哲亭
03-10
2933
elasticsearch简单使用
Elasticsearch之使用RestClient实现null和非null的查询操作
编程学习者的博客
08-01
587
版本:elasticsearch 7.13.4
1. 声明
当前内容主要为使用RestClient实现对Elasticsearch的null字段和非null字段的查询
当前内容基于前面的博文
2. 更新字段并设置值为null
更新属性并设置值为null
之前的内容
private static void updateDataSetBookNameEqNull(RestClient restClient) throws IOException {
Request request = new Reque
ElaticSearch进阶(7)_term+bool实现的multiword搜索原理
qq_24099547的博客
10-07
153
es 底层会将 match query 转成bool term 查询:match query --> bool + term。
例子:
1.普通match如何转换为term+should
"match": { "title": "java elasticsearch"}
用诸如上面的match query进行多值搜索的时候,es会在底层自动将这个match query转换...
Elastic Search:(四)搜索进阶
weixin_46181984的博客
09-07
200
目录
1 批量导入数据
1.1 目的
1.2 bulk指令
1.3 实操
2 term多种查询
2.1 exists 查询
2.2prefix 查询
2.3 wildcard查询
3 范围查询
3.1 基本内容
3.2 简单查询
3.3时间查询
1 批量导入数据
1.1 目的
在进行数据搜索之前,需要进行数据的创建,本文以多名歌手的基本信息作为搜索测试数据,采用bulk指令进行数据的批量导入,方便后续的数据搜索。
1.2 bulk指令
bulk为批量导入数据指令,采用P..
Elasticsearch之使用RestClient实现script、正则、count、source查询
编程学习者的博客
08-01
466
当前版本elasticsearch 7.13.4
1. 声明
当前内容主要为本人学习和使用RestClietn实现script、正则、count、source查询,主要参考:官方文档
主要涉及
使用script实现脚本查询
使用正则进行匹配查询
使用count查询文档数量
使用source只查询返回的_source中的内容
当前文章基于前面博文:Es操作
2. 基本的script查询
官方的:
但是本人用postman的为:
"query": {
"bool": {
"filt
ES文档常见增删改查操作
攀登Fox的博客
09-24
1780
目录一、新增文档(Document)1.1、put方式(需手动指定id)1.2、post方式二、查询文档三、修改文档四、删除文档
一、新增文档(Document)
1.1、put方式(需手动指定id)
格式:PUT /index_name/type_name/id{field_name:field_value}
示例:
PUT /test_index/my_type/1
"name":"test_doc_01",
"remark":"first test elastic put",
ElasticSearch 集群架构与搜索深入理解
littlejava_的博客
11-18
1034
一. Elasticsearch架构原理
1、Elasticsearch的节点类型
在Elasticsearch主要分成两类节点,一类是Master,一类是DataNode。
1.1 Master节点
在Elasticsearch启动时,会选举出来一个Master节点。当某个节点启动后,然后
使用Zen Discovery机制找到集群中的其他节点,并建立连接。
discovery.seed_hosts: ["192.168.21.130", "192.168.21.131", "192...
Elasticsearch built-in security features are not enabled.
qq_44768464的博客
09-04
6720
最近更新到Elastic Stack 7.13以上版本的朋友可能注意到了,在默认不开启Elastic 安全功能时,Kibana的搜索结果页面会多出一行提示,建议我们开启ElasticSearch 安全功能。
在个人学习或者内网开放ES+VPN连接的情况下我们完全不需要开启安全功能,其他情况在生产集群中还是建议开启安全选项的。
这是因为没有显式禁用安全选项导致的,也就是说ElasticSearch会提示你是不是忘了启用这个选项,只要在配置文件中显式禁用即可取消这个提示。
在elasticsearch.yml.
Elasticsearch 入门教程之基本操作查询(三)
尼古拉斯大树的博客
10-21
555
1.search检索文档
ES支持两种基本方式检索;
通过REST request uri 发送搜索参数 (uri +检索参数);
通过REST request body 来发送它们(uri+请求体);
GET bank/_search?q=*&sort=account_number:desc
请求参数方式检索
GET bank/_search?q=*&sort=account_number:asc
说明:
q=* # 查询所有
sort # 排序字段
asc #升序
等价
kibana操作ES简单操作之创建/更新/删除/查询索引等
weixin_43181007的博客
05-30
1619
ES创建字段映射规则,创建索引的各个字段类型新建一个索引"电影"的索引更新id是1的电影信息 将名字更新为"我不是药神==="查询该索引下所有的记录详情根据id查询记录详情创建索引字段映射的规则,设置字段类型删除id是2的电影删除"test"索引查看当前有多少索引以及版本信息等查看所有的索引的记录总条数
新建一个索引"电影"的索引
PUT /movie/type1(索引类型,可以不写)/1
"name":"我不是药神",
"type":"情感",
"publishYear":2018,
elasticsearch 笔记总结
xchenhao 的博客
12-21
2197
# 索引初始化
curl XPUT 'http://192.168.17.128:9200/library/' -d '{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
}'
# 获取索引设置信息
curl XGET 'http://192.168.1...
Elasticsearch之使用RestClient实现_sql查询
编程学习者的博客
08-01
639
版本:elasticsearch 7.13.4
1. 声明
当前内容主要为使用RestClient以及使用sql方式进行查询操作,主要参考官方文档
主要使用_sql方式进行查询
2. 主要demo
public static void main(String[] args) throws IOException {
RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200, "http")).build();
09 文档(document)操作
wyaoyao93的博客
11-29
266
文章目录1 新增文档1.1 指定id创建1.2 不指定指定id创建1.3 自动创建索引1.4 版本号1.5 操作类型1.6 分片选择1.7 其他说明2 ID查询文档2.1 入门2.2 禁用实时性2.3 _source2.3.1 不返回_source字段2.3.1 只返回_source字段(只获取文档内容)2.3.2 过滤_source2.4 分片选择2.5 其他查询参数2.6 多文档查询3 更新文档4 删除文档
文档是具体的数据,类似于数据库中的一条数据,文档必须包含在一个索引中
1 新增文档
需要注意的是
“相关推荐”对你有帮助么?
非常没帮助
没帮助
一般
有帮助
非常有帮助
提交
©️2022 CSDN
皮肤主题:鲸
设计师:meimeiellie
返回首页
scl、
CSDN认证博客专家
CSDN认证企业博客
码龄8年
Java领域新星创作者
437
原创
7951
周排名
8803
总排名
38万+
访问
等级
6464
积分
3784
粉丝
590
获赞
242
评论
2667
收藏
私信
关注
热门文章
MySQL约束机制_MySQL5.7实现性别限制只能男、女(CHECK虽不报错但没用)
29899
排序1_冒泡排序
25134
Vue解决报错1_This relative module was not found: * ./components/Login.vue in ./src/router/index.js
18980
Vue解决报错3_Syntax Error: TypeError: this.getOptions is not a function
18908
废旧Android手机搭建个人服务器:ksweb搭建Web服务器+Termux、Ngrok实现内网穿透
17915
分类专栏
easy code
17篇
leetcode
55篇
new coder
44篇
java boy
70篇
read books
17篇
JVM
5篇
JUC
11篇
database
10篇
nosql
8篇
graph databases
3篇
微服务组件
8篇
ElasticSearch
4篇
MQ
5篇
konw what and why
5篇
Kubernetes
2篇
docker
2篇
bug fix
13篇
others
8篇
courses
30篇
大一下开源网安视频学习笔记
54篇
vue
15篇
Linux
5篇
最新评论
ElasticSearch学习篇4_仿京东搜索案例练习
weixin_62239442:
commit为什么拿不到
Vue学习篇1_用户权限控制_登录的用户从后端获取角色信息role,前端动态展示侧边导航栏、不同资源
Pisces_224:
role在前端写死了啊
大数据疫情可视化平台1_基于Hadoop3.2.1、Hive3.1.2、搭建疫情信息可视化系统
qq_35071445:
博主你好,可以发一下源码吗,谢谢!
Vue解决报错9_人人开源renren-fast-vue执行npm install报错解决(sass的版本太低而node的版本太高导致)
weixin_62208015:
我的问题还没解决,按你说的修改版本,还不行,报错就和你之前的一样,修改版本之后还是这个报错
大一下期末_Web期末试题
xxxjxxxokl:
哥们2021年和这个差别大不大
您愿意向朋友推荐“博客详情页”吗?
强烈不推荐
不推荐
一般般
推荐
强烈推荐
提交
最新文章
《深入理解RPC框架原理与实现 华钟明》使用Netty、Zookeeper等实现一个简单的RPC框架、自定义注解、SPI机制实践与原理分析
常用日志解决方案实践与学习-基于AOP利用注解实现日志记录原理分析
常用日志解决方案实践与学习
2022年25篇
2021年178篇
2020年237篇
目录
目录
分类专栏
easy code
17篇
leetcode
55篇
new coder
44篇
java boy
70篇
read books
17篇
JVM
5篇
JUC
11篇
database
10篇
nosql
8篇
graph databases
3篇
微服务组件
8篇
ElasticSearch
4篇
MQ
5篇
konw what and why
5篇
Kubernetes
2篇
docker
2篇
bug fix
13篇
others
8篇
courses
30篇
大一下开源网安视频学习笔记
54篇
vue
15篇
Linux
5篇
目录
评论 1
被折叠的 条评论
为什么被折叠?
到【灌水乐园】发言
查看更多评论
打赏作者
scl、
你的鼓励将是我创作的最大动力
¥2
¥4
¥6
¥10
¥20
输入1-500的整数
余额支付
(余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付
您的余额不足,请更换扫码支付或充值
打赏作者
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额
抵扣说明:
1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。 2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。
余额充值