学无先后,达者为师

网站首页 编程语言 正文

ignore_above 解决keyword字段超长

作者:Jothan Zhong 更新时间: 2024-01-16 编程语言

ignore_above 解决keyword字段超长

  • 超过设定值->用wildcard等查不到
  • 也可用于解决keyword字段超长

在ElasticSearch中keyword类型字段可以设置ignore_above属性(默认是10) ,表示最大的字段值长度,超出这个长度的字段将不会被索引,但是会存储。

案例说明

DELETE my_index

PUT my_index
{
	"mappings": {
		"properties": {
			"name": {
				"type": "keyword",
				"ignore_above": 20
			}
		}
	}
}

POST my_index/_doc/1
{
  "name": "12345"
}

POST my_index/_doc/2
{
  "name": "123456789012345678901"
}



GET my_index/_search
{
  "query": {
    "wildcard": {
      "name": {
        "value": "123*"
      }
    }
  }
}

原文链接:https://blog.csdn.net/qq_43985303/article/details/128814556

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新