我的数据以以下格式存储在弹性搜索中
{
"_index": "wallet","_type": "wallet","_id": "5dfcbe0a6ca963f84470d852","_score": 0.69321066,"_source": {
"email": "test20011@gmail.com","wallet": "test20011@operatorqa2.akeodev.com","countryCode": "+91","phone": "7916318809","name": "test20011"
}
},{
"_index": "wallet","_id": "5dfcbe0a6ca9634d1c70d856","_source": {
"email": "test50011@gmail.com","wallet": "test50011@operatorqa2.akeodev.com","phone": "3483330496","name": "test50011"
}
},"_id": "5dfcbe0a6ca96304b370d857","_source": {
"email": "test110021@gmail.com","wallet": "test110021@operatorqa2.akeodev.com","phone": "2744697207","name": "test110021"
}
}
如果我们使用下面的查询,则找不到该记录
{
"query": {
"bool": {
"should": [
{
"match": {
"wallet": {
"query": "operatorqa2.akeodev.com","operator": "and"
}
}
},{
"match": {
"email": {
"query": "operatorqa2.akeodev.com","operator": "and"
}
}
}
]
}
}
}
记录应该找到我是否在查询下面传递
{
"query": {
"bool": {
"should": [
{
"match": {
"wallet": {
"query": "test20011@operatorqa2.akeodev.com",{
"match": {
"email": {
"query": "test20011@operatorqa2.akeodev.com","operator": "and"
}
}
}
]
}
}
}
我已经在电子邮件和钱包字段上创建了索引。
每当用户通过电子邮件或钱包搜索数据时,我不确定用户发送的字符串是电子邮件还是钱包,因此我正在使用bool
。
记录应查找用户是否发送了完整的电子邮件地址或完整的电子钱包地址。 请帮助我找到解决方法