我有一个这样的ES文档:
{
"_index" : "jobpipeline",
"_type" : "_doc",
"_id" : "xxxx",
"_version" : 19,
"_seq_no" : 417185,
"_primary_term" : 18,
"found" : true,
"_source" : {
"_boostScoreFactor" : 1.0,
"type" : "jobpipeline",
"owner" : [
""
],
"title" : "xxxx",
"watchTriggers" : [
"uc4.abc",
"uc4.abc.done"
],
"touchTriggers" : [
"uc4.abc.done"
],
}
}
如果我使用这样的查询,它什么也不返回。
GET jobpipeline/_search
{
"query": {
"wildcard": {
"touchTriggers": "*uc4.abc.done*"
}
}
}
如果我删除“uc4”,它可能会命中此文档。
GET dd-jobpipeline/_search
{
"query": {
"wildcard": {
"touchTriggers": "*abc.done*"
}
}
}
我应该怎么做才能使用'uc4.abc.done',它会击中文档?
touchTriggers字段的Map
"touchTriggers" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
下面是JobPipeline Index的设置。
{
"jobpipeline" : {
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"total_shards_per_node" : "2"
}
},
"number_of_shards" : "1",
"provided_name" : "jobpipeline",
"creation_date" : "1675246845838",
"unassigned" : {
"node_left" : {
"delayed_timeout" : "15m"
}
},
"analysis" : {
"filter" : {
"discovery_stemmer" : {
"type" : "stemmer",
"language" : "porter2"
},
"discovery_stemmer_possessive" : {
"type" : "stemmer",
"language" : "minimal_english"
},
"discovery_synonym_abbr" : {
"type" : "synonym_graph",
"synonyms" : [
"BN => browse node"
]
}
},
"char_filter" : {
"discovery_charfilter" : {
"type" : "mapping",
"mappings" : [
".=>|",
"_=>|",
"# => number",
"% => percentage",
"& => and",
"+ => browse node"
]
}
},
"normalizer" : {
"lowercase" : {
"filter" : [
"lowercase"
],
"type" : "custom",
"char_filter" : [ ]
}
},
"analyzer" : {
"discovery_index_analyzer" : {
"filter" : [
"lowercase",
"discovery_synonym_abbr"
],
"char_filter" : [
"discovery_charfilter"
],
"type" : "custom",
"tokenizer" : "standard"
}
}
},
"number_of_replicas" : "2",
"uuid" : "FtylpFoeRFSG6QVBVdoYOg",
"version" : {
"created" : "135238227"
}
}
}
}
}
是否需要更改此索引的设置或Map?
1条答案
按热度按时间zujrkrfu1#
您需要在
touchTriggers.keyword
字段上运行wildcard
查询,您将获得预期的响应。