因此,我需要基于一个名为"cash_transfer_ids“的字段检索记录,这是一个python。我希望检索其cash_transfer_ids包含特定id值(字符串)的所有记录。查询应该是什么样的呢?我应该使用匹配还是术语查询?
示例:我想检索任何cash_transfer_ids字段包含'abc‘的记录,然后我可能会得到记录,例如记录1:现金转移_I:'abc’记录2:现金转移_I:‘dfdfd’,‘abc’等等.
非常感谢您的帮助!
发布于 2022-10-04 17:33:31
如果cash_transfer_ids是关键字类型,我试着用词条过滤。
term = "abc"
query = {
"query": {
"term": {
"cash_transfer_ids": {
"value": term
}
}
}
}
response = get_client_es().search(index="idx_test", body=query)
https://stackoverflow.com/questions/73954838
复制