2020-09-22

1.创建索引
put http://ip:9200/bos-base-tenant-2020-09-22-log
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
"max_ngram_diff": 30
},
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 30
}
},
"analyzer": {
"autocomplete_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
},
"mappings": {
"_doc": {
"properties": {
"userID": {
"type": "integer"
},
"opname": {
"type": "text",
"analyzer": "autocomplete_analyzer",
"search_analyzer": "standard"
},
"description": {
"type": "text",
"analyzer": "autocomplete_analyzer",
"search_analyzer": "standard"
},
"time": {
"type": "date"
}
}
}
}
}

2.搜索数据
post http://ip:9200/bos-base-tenant-2020-09-22-log/_search
{
"query": {
"bool": {
"must": [
{
"range": {
"time": {
"gte": 1600617600,
"lte": "now"
}
}
},
{
"bool": {
"should": [
{
"match_phrase": {
"description": "用户名或密码错误"
}
},
{
"match_phrase": {
"opname": "流程管理"
}
}
]
}
}
]
}
},
"sort": [],
"from": 0,
"size": 100
}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。