为了达到该要求,您需要查看嵌套对象,而不是查询平整的值列表,而是查询该嵌套对象中的各个值。例如:
{ "mappings": { "people": { "properties": { "name": { "type": "string" }, "quotations": { "type": "nested", "properties": { "value": { "type": "string" } } } } } }}值:
{"name":"Mr A","quotations":[{"value": "quotation one, this and that and these"}, {"value": "quotation two, those and that"}]}{"name":"Mr B","quotations":[{"value": "quotation three, this and that"}, {"value": "quotation four, those and these"}]}查询:
{ "query": { "nested": { "path": "quotations", "query": { "bool": { "must": [ { "match": {"quotations.value": "this"}}, { "match": {"quotations.value": "these"}} ] } } } }}


