【发布时间】:2021-04-21 22:03:00
【问题描述】:
我需要在 Elasticsearch 中进行查询,该查询只有在搜索文本中的所有单词都被找到时才返回文档,无论在哪个字段中。例如:
searchText = "term1 term2 term3 term4"
fields = ['field1', 'field2', 'field3', 'field4', 'field5', 'field6']
如果 searchText 中的所有单词都在从 1 到 6 的任何字段中,则返回文档。否则什么都不返回。谢谢!
这种文件应该被退回:
searchText = 'We need to change ourselves'
fields = [
field1: "We are happy.",
field2: "change ourselves",
field3: "You are the one I need"
field4: "to be",
field5: "irrelevant",
field6: ""
]
但不是这个(未找到:We,ourserves):
searchText = 'We need to change ourselves'
fields = [
field1: "I am happy.",
field2: "change",
field3: "You are the one I need"
field4: "to be",
field5: "irrelevant",
field6: "something"
]
【问题讨论】:
标签: elasticsearch