ES kibana 创建索引快速脚本

删除

复制代码
DELETE my_test

创建索引

创建自定义ngram分词器

复制代码
PUT my_test 
{
  "settings": {
    "index.max_ngram_diff": "32",
    "analysis": {
			"analyzer": {
				"code_analyzer": {
					"tokenizer": "code_tokenizer",
					"filter": [
                    	"lowercase"
                    ]
				}
			},
			"tokenizer": {
				"code_tokenizer": {
					"token_chars": [
						"letter",
						"digit"
					],
					"min_gram": "3",
					"type": "ngram",
					"max_gram": "32"
				}
			}
		}
  } 
}

设置字段

复制代码
PUT my_test/_mapping
{
  "properties": {
    "name":{
      "type":"text",
      "analyzer":"code_analyzer"
    }
  }
}

上传测试文档

复制代码
PUT my_test/_doc/1
{
  "name":"测试搜索09"
}

PUT my_test/_doc/2
{
  "name":"2009"
}

测试

复制代码
GET my_test/_search
{
  "query":{
    "match_phrase": {
      "name": "092"
    }
  }
}

测试分词

复制代码
GET my_test/_analyze
{
  "text": "测试搜索09",
  "tokenizer": "ngram"
}

GET core_product_basic/_analyze
{
  "text": "测试搜索09",
  "tokenizer": "ngram"
}
相关推荐
G皮T16 小时前
【Elasticsearch】映射:null_value 详解
大数据·elasticsearch·搜索引擎·映射·mappings·null_value
Elasticsearch2 天前
ES8 向量功能窥探系列(二):向量数据的存储与优化
elasticsearch
安审若无2 天前
Elasticsearch中的监控(Monitoring)功能介绍
elasticsearch·搜索引擎·全文检索
leo_hush2 天前
elasticsearch基本操作笔记
elasticsearch
咸鱼求放生2 天前
es在Linux安装
大数据·elasticsearch·搜索引擎
xyhshen2 天前
k8s下离线搭建elasticsearch
elasticsearch·容器·kubernetes
@泽栖3 天前
ES数据聚合
elasticsearch·搜索引擎
張萠飛3 天前
Linux下如何使用shell脚本导出elasticsearch中某一个index的数据为本地csv文件
linux·运维·elasticsearch
LanLance3 天前
ES101系列09 | 运维、监控与性能优化
java·运维·后端·elasticsearch·云原生·性能优化·golang
疯狂的沙粒3 天前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch