Elasticsearch---DSL搜索实践
- 数据准备
POST http://192.168.2.223:9200/shop/_mapping
{
"properties": {
"id": {
"type": "long"
},
"age": {
"type": "integer"
},
"username": {
"type": "keyword"
},
"nickname": {
"type": "text",
"analyzer": "ik_max_word"
},
"money": {
"type": "float"
},
"desc": {
"type": "text",
"analyzer": "ik_max_word"
},
"sex": {
"type": "byte"
},
"birthday": {
"type": "date"
},
"face": {
"type": "text",
"index": false
}
}
}
POST http://192.168.2.223:9200/shop/_doc/1001
{
"id": 1011,
"age": 31,
"username": "sprder",
"nickname": "皮特帕克",
"money": 180.8,
"desc": "它是一个超级英雄",
"sex": 1,
"birthday": "1989-08-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1008,
"age": 19,
"username": "zhoujiang",
"nickname": "周江",
"money": 1056.8,
"desc": "周江大学毕业后,进了阿里",
"sex": 1,
"birthday": "1995-06-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1007,
"age": 19,
"username": "msgame",
"nickname": "gamexbox",
"money": 1056.8,
"desc": "明天去进货,最近微软处理很多游戏机,还要买xbox游戏卡带",
"sex": 1,
"birthday": "1985-05-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1003,
"age": 20,
"username": "bigFace",
"nickname": "飞翔的巨鹰",
"money": 66.8,
"desc": "周江和导游坐飞机去海外旅游,去了新马泰和欧洲",
"sex": 1,
"birthday": "1996-01-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1002,
"age": 19,
"username": "zhouhong",
"nickname": "周红",
"money": 77.8,
"desc": "今天上下班都很堵,车流量很大",
"sex": 1,
"birthday": "1993-01-24",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1012,
"age": 31,
"username": "super hero",
"nickname": "super hero",
"money": 188.8,
"desc": "BatMan, GreenArrow, SpiderMan, IronMan... are all Super Hero",
"sex": 1,
"birthday": "1980-08-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1010,
"age": 30,
"username": "tata",
"nickname": "隔壁老王",
"money": 100.8,
"desc": "隔壁老外去国外出差,带给我很多好吃的",
"sex": 1,
"birthday": "1988-07-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1009,
"age": 22,
"username": "shaonian",
"nickname": "骚年轮",
"money": 96.8,
"desc": "骚年在大学毕业后,考研究生去了",
"sex": 1,
"birthday": "1998-07-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1006,
"age": 19,
"username": "zhouhong",
"nickname": "我叫周红",
"money": 156.8,
"desc": "我叫周红,今年20岁,是一名毕业生,我在琦䯲星球做演讲",
"sex": 1,
"birthday": "1993-04-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1005,
"age": 25,
"username": "gotoplay",
"nickname": "ps游戏机",
"money": 155.8,
"desc": "今年生日,女友送了我一台play station游戏机,非常好玩,非常不错",
"sex": 1,
"birthday": "1989-03-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1004,
"age": 22,
"username": "flyfish",
"nickname": "水中鱼",
"money": 55.8,
"desc": "昨天周红在学校的池塘里,看到有很多鱼在游泳",
"sex": 0,
"birthday": "1988-02-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1001,
"age": 18,
"username": "zhoujiang",
"nickname": "周江",
"money": 88.8,
"desc": "周江在大学学习java和前端",
"sex": 0,
"birthday": "1992-12-24",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
- http://192.168.2.223:9200/shop/_search?q=desc:周红&q=age:20
{
"took": 8,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "shop",
"_type": "_doc",
"_id": "1003",
"_score": 1,
"_source": {
"id": 1003,
"age": 20,
"username": "bigFace",
"nickname": "飞翔的巨鹰",
"money": 66.8,
"desc": "周江和导游坐飞机去海外旅游,去了新马泰和欧洲",
"sex": 1,
"birthday": "1996-01-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
}
]
}
}
- match_all 检索
- 查询所有:POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match_all": {}
}
}- 查询部分字段 : POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match_all": {}
},
"_source": ["id","username","age"]
}- 分页查询: POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match_all": {}
},
"_source": ["id","username","age"],
"from": 0,
"size": 5
}
- match_phrase 查询同一个字段中几个词,可以跳过其他词,slop表示可以跳过的最大词数
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match_phrase": {
"desc": {
"query": "今天 车流量",
"slop": 100
}
}
}
}
- term 单个条件查询(不会进行分词、将输入字符当做关键字查找,精确匹配)
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"term": {
"desc": "学习"
}
}
}
- terms 对个关键字查询
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"terms": {
"desc": ["学习","周红","周江"]
}
}
}
- match 条件查询(会对输入的字符进行分词操作、全文检索):
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match": {
"desc": "周红"
}
},
"_source": ["id","username","age"]
}
- POST http://192.168.2.223:9200/shop/_doc/_search operator 为 “or”表示:字段只要有一个分词就可以查出来,operator 为 “and”表示:字段必须包含分词分出来的所有字段。
{
"query": {
"match": {
"desc": {
"query": "周红",
"operator": "and"
}
}
},
"_source": ["id","username","age"]
}
- POST http://192.168.2.223:9200/shop/_doc/_search
- minimum_should_match: 最低匹配精度,至少有[分词后的词语个数]x百分百,得出一个数据值取整。举个例子:当前属性设置为70,若一个用户查询检索内容分词后有10个词语,那么匹配度按照 10x70%=7,则desc中至少需要有7个词语匹配,就展示;若分词后有8个,则 8x70%=5.6,则desc中至少需要有5个词语匹配,就展示。
- minimum_should_match 也能设置具体的数字,表示拆分出来的词在一个字段中个数
{
"query": {
"match": {
"desc": {
"query": "女友生日送我好玩的xbox游戏机",
"minimum_should_match": "60%"
}
}
}
}
- POST http://192.168.2.223:9200/shop/_doc/_search 根据文档 ids 进行查找
{
"query": {
"ids": {
"type": "_doc",
"values": ["1001","1005","1006"]
}
},
"_source": ["id","username","desc"]
}
- multi_match 对多个字段进行检索
- POST http://192.168.2.223:9200/shop/_doc/_search ^10 表示权重,权重,为某个字段设置权重,权重越高,文档相关性得分就越高。通畅来说搜索商品名称要比商品简介的权重更高。
{
"query": {
"multi_match": {
"query": "游戏",
"fields": [
"desc^10","nickname"
]
}
}
}
- bool 查询
- POST http://192.168.2.223:9200/shop/_doc/_search
- must :多个条件全部要满足, should:或者的意思,满足一个条件即可,must_not :除了满足所有条件剩下的数据。
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "游戏",
"fields": ["desc","nickname"]
}
},
{
"term": {
"age": "19"
}
}
]
}
}
}
- post_filter 过滤器
- POST http://192.168.2.223:9200/shop/_doc/_search
- 对搜索出来的结果进行数据过滤。不会到es库里去搜,不会去计算文档的相关度分数,所以过滤的性能会比较高,过滤器可以和全文搜索结合在一起使用。
- query:根据用户搜索条件检索匹配记录
- post_filter:用于查询后,对结果数据的筛选
{
"query": {
"match": {
"sex": "1"
}
},
"post_filter": {
"range": {
"money": {
"gte": 60,
"lte": 155.8
}
}
}
}
- sort 排序功能
- POST http://192.168.2.223:9200/shop/_doc/_search 先以money排序再以age排序,注意:只能对整形排序,不能对文本类型排序。
{
"query": {
"match": {
"sex": "1"
}
},
"sort": [
{
"money": "asc"
},
{
"age": "asc"
}
]
}
- 对文本排序
- 需要对排序字段加一个附加属性,类型选择为keyword
1.创建索引
POST /shop2/_mapping
{
"properties": {
"id": {
"type": "long"
},
"nickname": {
"type": "text",
"analyzer": "ik_max_word",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}2.插入数据
POST /shop2/_doc
{
"id": 1001,
"nickname": "美丽的风景"
}
{
"id": 1002,
"nickname": "漂亮的小哥哥"
}
{
"id": 1003,
"nickname": "飞翔的巨鹰"
}
{
"id": 1004,
"nickname": "完美的天空"
}
{
"id": 1005,
"nickname": "广阔的海域"
}3.排序 POST http://192.168.2.223:9200/shop2/_doc/_search
{
"sort": [
{
"nickname.keyword": "desc"
}
]
}
- exists 判断字段是否存在
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"exists": {
"field": "desc"
}
}
}
- highlight 关键字高亮显示
- POST http://192.168.2.223:9200/shop/_doc/_search
{
"query": {
"match": {
"desc": "周红"
}
},
"highlight": {
"pre_tags": ["<span>"],
"post_tags": ["</span>"],
"fields": {
"desc": {}
}
}
}结果:默认为em标签,上面设置为自定义的<span>标签,对页面 em/span 标签做一个颜色设置就可以实现高亮显示了。{
"took": 110,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1.1329247,
"hits": [
{
"_index": "shop",
"_type": "_doc",
"_id": "1004",
"_score": 1.1329247,
"_source": {
"id": 1004,
"age": 22,
"username": "flyfish",
"nickname": "水中鱼",
"money": 55.8,
"desc": "昨天周红在学校的池塘里,看到有很多鱼在游泳",
"sex": 0,
"birthday": "1988-02-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
},
"highlight": {
"desc": [
"昨天<em>周红</em>在学校的池塘里,看到有很多鱼在游泳"
]
}
},
{
"_index": "shop",
"_type": "_doc",
"_id": "1006",
"_score": 0.9585575,
"_source": {
"id": 1006,
"age": 19,
"username": "zhouhong",
"nickname": "我叫周红",
"money": 156.8,
"desc": "我叫周红,今年20岁,是一名毕业生,我在琦䯲星球做演讲",
"sex": 1,
"birthday": "1993-04-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
},
"highlight": {
"desc": [
"我叫<em>周红</em>,今年20岁,是一名毕业生,我在琦䯲星球做演讲"
]
}
}
]
}
- 数据准备
{
"properties": {
"id": {
"type": "long"
},
"age": {
"type": "integer"
},
"username": {
"type": "keyword"
},
"nickname": {
"type": "text",
"analyzer": "ik_max_word"
},
"money": {
"type": "float"
},
"desc": {
"type": "text",
"analyzer": "ik_max_word"
},
"sex": {
"type": "byte"
},
"birthday": {
"type": "date"
},
"face": {
"type": "text",
"index": false
}
}
}
{
"id": 1011,
"age": 31,
"username": "sprder",
"nickname": "皮特帕克",
"money": 180.8,
"desc": "它是一个超级英雄",
"sex": 1,
"birthday": "1989-08-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1008,
"age": 19,
"username": "zhoujiang",
"nickname": "周江",
"money": 1056.8,
"desc": "周江大学毕业后,进了阿里",
"sex": 1,
"birthday": "1995-06-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1007,
"age": 19,
"username": "msgame",
"nickname": "gamexbox",
"money": 1056.8,
"desc": "明天去进货,最近微软处理很多游戏机,还要买xbox游戏卡带",
"sex": 1,
"birthday": "1985-05-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1003,
"age": 20,
"username": "bigFace",
"nickname": "飞翔的巨鹰",
"money": 66.8,
"desc": "周江和导游坐飞机去海外旅游,去了新马泰和欧洲",
"sex": 1,
"birthday": "1996-01-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1002,
"age": 19,
"username": "zhouhong",
"nickname": "周红",
"money": 77.8,
"desc": "今天上下班都很堵,车流量很大",
"sex": 1,
"birthday": "1993-01-24",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1012,
"age": 31,
"username": "super hero",
"nickname": "super hero",
"money": 188.8,
"desc": "BatMan, GreenArrow, SpiderMan, IronMan... are all Super Hero",
"sex": 1,
"birthday": "1980-08-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1010,
"age": 30,
"username": "tata",
"nickname": "隔壁老王",
"money": 100.8,
"desc": "隔壁老外去国外出差,带给我很多好吃的",
"sex": 1,
"birthday": "1988-07-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1009,
"age": 22,
"username": "shaonian",
"nickname": "骚年轮",
"money": 96.8,
"desc": "骚年在大学毕业后,考研究生去了",
"sex": 1,
"birthday": "1998-07-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1006,
"age": 19,
"username": "zhouhong",
"nickname": "我叫周红",
"money": 156.8,
"desc": "我叫周红,今年20岁,是一名毕业生,我在琦䯲星球做演讲",
"sex": 1,
"birthday": "1993-04-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1005,
"age": 25,
"username": "gotoplay",
"nickname": "ps游戏机",
"money": 155.8,
"desc": "今年生日,女友送了我一台play station游戏机,非常好玩,非常不错",
"sex": 1,
"birthday": "1989-03-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1004,
"age": 22,
"username": "flyfish",
"nickname": "水中鱼",
"money": 55.8,
"desc": "昨天周红在学校的池塘里,看到有很多鱼在游泳",
"sex": 0,
"birthday": "1988-02-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
{
"id": 1001,
"age": 18,
"username": "zhoujiang",
"nickname": "周江",
"money": 88.8,
"desc": "周江在大学学习java和前端",
"sex": 0,
"birthday": "1992-12-24",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
- http://192.168.2.223:9200/shop/_search?q=desc:周红&q=age:20
"took": 8,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "shop",
"_type": "_doc",
"_id": "1003",
"_score": 1,
"_source": {
"id": 1003,
"age": 20,
"username": "bigFace",
"nickname": "飞翔的巨鹰",
"money": 66.8,
"desc": "周江和导游坐飞机去海外旅游,去了新马泰和欧洲",
"sex": 1,
"birthday": "1996-01-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
}
}
]
}
}
- match_all 检索
"query": {
"match_all": {}
}
}
- 查询部分字段 : POST http://192.168.2.223:9200/shop/_doc/_search
"query": {
"match_all": {}
},
"_source": ["id","username","age"]
}
- 分页查询: POST http://192.168.2.223:9200/shop/_doc/_search
"query": {
"match_all": {}
},
"_source": ["id","username","age"],
"from": 0,
"size": 5
}
- match_phrase 查询同一个字段中几个词,可以跳过其他词,slop表示可以跳过的最大词数
"query": {
"match_phrase": {
"desc": {
"query": "今天 车流量",
"slop": 100
}
}
}
}
- term 单个条件查询(不会进行分词、将输入字符当做关键字查找,精确匹配)
"query": {
"term": {
"desc": "学习"
}
}
}
- terms 对个关键字查询
"query": {
"terms": {
"desc": ["学习","周红","周江"]
}
}
}
- match 条件查询(会对输入的字符进行分词操作、全文检索):
"query": {
"match": {
"desc": "周红"
}
},
"_source": ["id","username","age"]
}
- POST http://192.168.2.223:9200/shop/_doc/_search operator 为 “or”表示:字段只要有一个分词就可以查出来,operator 为 “and”表示:字段必须包含分词分出来的所有字段。
"query": {
"match": {
"desc": {
"query": "周红",
"operator": "and"
}
}
},
"_source": ["id","username","age"]
}
- POST http://192.168.2.223:9200/shop/_doc/_search
- minimum_should_match: 最低匹配精度,至少有[分词后的词语个数]x百分百,得出一个数据值取整。举个例子:当前属性设置为70,若一个用户查询检索内容分词后有10个词语,那么匹配度按照 10x70%=7,则desc中至少需要有7个词语匹配,就展示;若分词后有8个,则 8x70%=5.6,则desc中至少需要有5个词语匹配,就展示。
- minimum_should_match 也能设置具体的数字,表示拆分出来的词在一个字段中个数
"query": {
"match": {
"desc": {
"query": "女友生日送我好玩的xbox游戏机",
"minimum_should_match": "60%"
}
}
}
}
- POST http://192.168.2.223:9200/shop/_doc/_search 根据文档 ids 进行查找
"query": {
"ids": {
"type": "_doc",
"values": ["1001","1005","1006"]
}
},
"_source": ["id","username","desc"]
}
- multi_match 对多个字段进行检索
- POST http://192.168.2.223:9200/shop/_doc/_search ^10 表示权重,权重,为某个字段设置权重,权重越高,文档相关性得分就越高。通畅来说搜索商品名称要比商品简介的权重更高。
"query": {
"multi_match": {
"query": "游戏",
"fields": [
"desc^10","nickname"
]
}
}
}
- bool 查询
- POST http://192.168.2.223:9200/shop/_doc/_search
- must :多个条件全部要满足, should:或者的意思,满足一个条件即可,must_not :除了满足所有条件剩下的数据。
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "游戏",
"fields": ["desc","nickname"]
}
},
{
"term": {
"age": "19"
}
}
]
}
}
}
- post_filter 过滤器
- POST http://192.168.2.223:9200/shop/_doc/_search
- 对搜索出来的结果进行数据过滤。不会到es库里去搜,不会去计算文档的相关度分数,所以过滤的性能会比较高,过滤器可以和全文搜索结合在一起使用。
- query:根据用户搜索条件检索匹配记录
- post_filter:用于查询后,对结果数据的筛选
"query": {
"match": {
"sex": "1"
}
},
"post_filter": {
"range": {
"money": {
"gte": 60,
"lte": 155.8
}
}
}
}
- sort 排序功能
- POST http://192.168.2.223:9200/shop/_doc/_search 先以money排序再以age排序,注意:只能对整形排序,不能对文本类型排序。
"query": {
"match": {
"sex": "1"
}
},
"sort": [
{
"money": "asc"
},
{
"age": "asc"
}
]
}
- 对文本排序
- 需要对排序字段加一个附加属性,类型选择为keyword
POST /shop2/_mapping
{
"properties": {
"id": {
"type": "long"
},
"nickname": {
"type": "text",
"analyzer": "ik_max_word",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
POST /shop2/_doc
{
"id": 1001,
"nickname": "美丽的风景"
}
{
"id": 1002,
"nickname": "漂亮的小哥哥"
}
{
"id": 1003,
"nickname": "飞翔的巨鹰"
}
{
"id": 1004,
"nickname": "完美的天空"
}
{
"id": 1005,
"nickname": "广阔的海域"
}
{
"sort": [
{
"nickname.keyword": "desc"
}
]
}
- exists 判断字段是否存在
"query": {
"exists": {
"field": "desc"
}
}
}
- highlight 关键字高亮显示
"query": {
"match": {
"desc": "周红"
}
},
"highlight": {
"pre_tags": ["<span>"],
"post_tags": ["</span>"],
"fields": {
"desc": {}
}
}
}
"took": 110,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 2,
"relation": "eq"
},
"max_score": 1.1329247,
"hits": [
{
"_index": "shop",
"_type": "_doc",
"_id": "1004",
"_score": 1.1329247,
"_source": {
"id": 1004,
"age": 22,
"username": "flyfish",
"nickname": "水中鱼",
"money": 55.8,
"desc": "昨天周红在学校的池塘里,看到有很多鱼在游泳",
"sex": 0,
"birthday": "1988-02-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
},
"highlight": {
"desc": [
"昨天<em>周红</em>在学校的池塘里,看到有很多鱼在游泳"
]
}
},
{
"_index": "shop",
"_type": "_doc",
"_id": "1006",
"_score": 0.9585575,
"_source": {
"id": 1006,
"age": 19,
"username": "zhouhong",
"nickname": "我叫周红",
"money": 156.8,
"desc": "我叫周红,今年20岁,是一名毕业生,我在琦䯲星球做演讲",
"sex": 1,
"birthday": "1993-04-14",
"face": "https://www.zhouhong.com/static/img/index/logo.png"
},
"highlight": {
"desc": [
"我叫<em>周红</em>,今年20岁,是一名毕业生,我在琦䯲星球做演讲"
]
}
}
]
}
}
Elasticsearch---DSL搜索实践的更多相关文章
- Elasticsearch(ES)的高级搜索(DSL搜索)(上篇)
1. 概述 之前聊了一下 Elasticsearch(ES)的基本使用,今天我们聊聊 Elasticsearch(ES)的高级搜索(DSL搜索),由于DSL搜索内容比较多,因此分为两篇文章完成. 2. ...
- Elasticsearch(ES)的高级搜索(DSL搜索)(下篇)
1. 概述 之前聊了Elasticsearch(ES)的高级搜索(DSL搜索)的一部分内容,今天把剩下的部分聊完. 2. 场景说明 2.1 创建索引同时创建映射 PUT http://192.168 ...
- ElasticSearch位置搜索
ElasticSearch位置搜索 学习了:https://blog.csdn.net/bingduanlbd/article/details/52253542 学习了:https://blog.cs ...
- ElasticSearch入门-搜索(java api)
ElasticSearch入门-搜索(java api) package com.qlyd.searchhelper; import java.util.Map; import net.sf.json ...
- PHP使用ElasticSearch做搜索
PHP 使用 ElasticSearch 做搜索 https://blog.csdn.net/zhanghao143lina/article/details/80280321 https://www. ...
- 十九种Elasticsearch字符串搜索方式终极介绍
前言 刚开始接触Elasticsearch的时候被Elasticsearch的搜索功能搞得晕头转向,每次想在Kibana里面查询某个字段的时候,查出来的结果经常不是自己想要的,然而又不知道问题出在了哪 ...
- Elasticsearch实现搜索推荐词
本篇介绍的是基于Elasticsearch实现搜索推荐词,其中需要用到Elasticsearch的pinyin插件以及ik分词插件,代码的实现这里提供了java跟C#的版本方便大家参考. 1.实现的结 ...
- Elasticsearch 为了搜索
前言 Elasticsearch 是一个开源的搜索引擎,建立在一个全文搜索引擎库 Apache Lucene 基础之上. Lucene 可以说是当下最先进.高性能.全功能的搜索引擎库--无论是开源还是 ...
- Elasticsearch分布式搜索和数据分析引擎-ElasticStack(上)v7.14.0
Elasticsearch概述 **本人博客网站 **IT小神 www.itxiaoshen.com Elasticsearch官网地址 https://www.elastic.co/cn/elast ...
随机推荐
- linux常用命令(shell脚本常用命令)(grep、cut、sort、uniq、seq、tr、basename、dirname)
本章命令: 1 2 3 4 5 6 grep cut sort uniq seq tr 1.grep 作用:过滤文本内容 选项 描述 -E :--extended--regexp 模式是扩展正则表达式 ...
- 39.NFS(网络文件系统)
要共享文件的主机都是Linux系统时推荐在客户端部署NFS 服务来共享文件. NFS(网络文件系统)服务可以将远程Linux 系统上的文件共享资源挂载到本地主机的目录上,从而使得本地主机(Linux ...
- BGP总结(三)
3.BGP路由汇总 在大规模的网络中,BGP路由表十分庞大,给设备造成了很大的负担,同时使发生路由振荡的几率也大大增加,影响网络的稳定性.路由聚合是将多条路由合并的机制,它通过只向对等体发送聚合后的路 ...
- Python实现量子态采样
什么是量子态矢量? 在前面一篇量子系统模拟的博客中,我们介绍了使用python去模拟一个量子系统演化的过程.当我们尝试理解量子态和量子门操作时,可以通过其矩阵形式的运算来描述量子态演化的过程: \[\ ...
- 关于RabbitMQ的简单理解
说明:想要理解RabbitMQ,需要先理解MQ是什么?能做什么?然后根据基础知识去理解RabbitMQ是什么.提供了什么功能. 一.MQ的简单理解 1. 什么是MQ? 消息队列(Message Que ...
- 2019 China Collegiate Programming Contest Qinhuangdao Onsite F. Forest Program(DFS计算图中所有环的长度)
题目链接:https://codeforces.com/gym/102361/problem/F 题意 有 \(n\) 个点和 \(m\) 条边,每条边属于 \(0\) 或 \(1\) 个环,问去掉一 ...
- 用Python修改本机适配器信息
主要参考来自[用Python干实事(一)自动修改Windows的IP.网关和DNS设置]. 使用_winreg模块来操作注册表实现相关信息的修改,它是python的内置模块.也可以通过Win32 Ex ...
- SCZ 20170812 T2 MFS
题面照例十分暴力,我再次重写一下吧-- 题目描述 有\(n\)个数构成的数列\(A\)元素为\(a_i\),你要构造一个数列\(B\),元素为\(b_i\),使得满足\(b_{i}>0,a_{i ...
- poj2926Requirements (曼哈顿距离)
Description An undergraduate student, realizing that he needs to do research to improve his chances ...
- hdu4686 Arc of Dream
Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission ...