你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
printf_uck - 1024
赞同来自:
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
bedman - 90hou
要回复问题请先登录或注册
90hou
3 个回复
printf_uck - 1024
赞同来自:
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
bedman - 90hou
赞同来自:
mapping(新增了一个analyzer为”my_analyzer_forsearch“):{
"lower_index111": {
"aliases": {},
"mappings": {
"doc": {
"dynamic_templates": [
{
"strings_analyzed": {
"match_mapping_type": "string",
"mapping": {
"analyzer": "my_analyzer",
"index_options": "offsets",
"search_analyzer": "my_analyzer_forsearch",
"type": "text"
}
}
},
{
"strings_not_analyzed": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
],
"properties": {
"value": {
"type": "text",
"index_options": "offsets",
"analyzer": "my_analyzer",
"search_analyzer": "my_analyzer_forsearch"
}
}
},
"_default_": {
"dynamic_templates": [
{
"strings_analyzed": {
"match_mapping_type": "string",
"mapping": {
"analyzer": "my_analyzer",
"index_options": "offsets",
"search_analyzer": "my_analyzer_forsearch",
"type": "text"
}
}
},
{
"strings_not_analyzed": {
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}
]
}
},
"settings": {
"index": {
"number_of_shards": "5",
"provided_name": "lower_index111",
"creation_date": "1555382095182",
"analysis": {
"analyzer": {
"my_analyzer": {
"filter": [
"asciifolding"
],
"type": "custom",
"tokenizer": "standard"
},
"my_analyzer_forsearch": {
"filter": [
"asciifolding"
],
"type": "custom",
"tokenizer": "lowercase"
}
}
},
"number_of_replicas": "1",
"uuid": "kNi6FW2ZSz-fbxAm5xWDtg",
"version": {
"created": "5040199"
}
}
}
}
}
这个是分词结果(为大写”Is“):
{
"_index": "lower_index111",
"_type": "doc",
"_id": "1",
"_version": 1,
"found": true,
"took": 0,
"term_vectors": {
"value": {
"field_statistics": {
"sum_doc_freq": 4,
"doc_count": 1,
"sum_ttf": 4
},
"terms": {
"Is": {
"term_freq": 1,
"tokens": [
{
"position": 0,
"start_offset": 0,
"end_offset": 2
}
]
},
"an": {
"term_freq": 1,
"tokens": [
{
"position": 2,
"start_offset": 8,
"end_offset": 10
}
]
},
"apple": {
"term_freq": 1,
"tokens": [
{
"position": 3,
"start_offset": 11,
"end_offset": 16
}
]
},
"this": {
"term_freq": 1,
"tokens": [
{
"position": 1,
"start_offset": 3,
"end_offset": 7
}
]
}
}
}
}
}
这个是查询条件,用的小写”is“,分词器指定了”my_analyzer_forsearch“:
{
"query": {
"bool": {
"must": [{
"query_string": {
"query": "is",
"analyze_wildcard": true,
"default_operator":"AND",
"analyzer":"my_analyzer_forsearch"
}
}],
"must_not": []
}
}
}