如何在弹性搜索的文本中使用 - 查询字符串
how to query strings with - in the text in elastic search
我在两个字段中查找数据,其中一个字段必须相同,一个使用查询
{
"from": 0,
"size": 5,
"query": {
"bool": {
"must": [
{
"match": { "NIPNAS": "2000259"}
},
{
"query_string": {
"default_field": "SID",
"query": "300106840-0031375024"
}
}
]
}
}
}
当我输入与记录相同的文本时,出现了我想要的数据,但是当我只将文本写入破折号时,数据却没有出现
{
"from": 0,
"size": 5,
"query": {
"bool": {
"must": [
{ "match": { "NIPNAS": "2000259"}},
{ "wildcard": {
"SID.keyword": "300106840-00313750*"
}}
]
}
}
}
我使用通配符搜索而不是查询字符串
我在两个字段中查找数据,其中一个字段必须相同,一个使用查询
{
"from": 0,
"size": 5,
"query": {
"bool": {
"must": [
{
"match": { "NIPNAS": "2000259"}
},
{
"query_string": {
"default_field": "SID",
"query": "300106840-0031375024"
}
}
]
}
}
}
当我输入与记录相同的文本时,出现了我想要的数据,但是当我只将文本写入破折号时,数据却没有出现
{
"from": 0,
"size": 5,
"query": {
"bool": {
"must": [
{ "match": { "NIPNAS": "2000259"}},
{ "wildcard": {
"SID.keyword": "300106840-00313750*"
}}
]
}
}
}
我使用通配符搜索而不是查询字符串