GET taps/_search
{
"query": {
"bool": {
"should": [
{ "match": { "test_card": "ZE-S-180x4" }},
{ "match": { "pf": "ZX480" }},
{ "match": { "fpc": "AEZE 3D MP+6E" }},
{ "match": { "rpd": "32" }},
{ "match": { "rel": "25" }},
{ "match": { "rel_type": "1234_daily" }}
]
}
}
}
fpc没有获得单字匹配,它查询为3个单词并获得更多结果。
答案 0 :(得分:1)
为了让ES忽略空格,如果下面的match
中的字符串值之间有加号怎么办?
{ "match": { "fpc": "AEZE","3D","MP+6E" }}
或强>
当您为字段创建映射时,您可以将字段完全匹配,如下所示:
curl -XPUT localhost:9200/my_index -d '{
"mappings": {
"my_type": {
"properties": {
"instruments": {
"type": "string",
"index": "not_analyzed" <--- you need to have this for the field to get tokenized
}
}
}
}
}'
当然,你可以继续匹配白色空格的字符串。