查询语句:
{"from":0,"size":100,"search_after":[0],"query":{"bool":{"must":[{"term":{"sex":"女"}},{"range":{"age":{"gte":30,"lte":40}}},{"bool":{"should":[{"bool":{"must":[{"match_phrase":{"province":"辽宁省"}},{"match_phrase":{"city":"沈阳市"}}]}},{"bool":{"must":[{"match_phrase":{"province":"辽宁省"}},{"match_phrase":{"city":"抚顺市"}}]}}]}},{"nested":{"path":"orders","inner_hits":{"from":0,"size":100},"query":{"bool":{"must":[{"range":{"orders.bookingTime":{"gte":"2020-01-01 08:00:00","lte":"2021-08-13 23:59:59","format":"yyyy-MM-dd HH:mm:ss"}}},{"terms":{"orders.ticketId":[530535]}},{"terms":{"orders.bookingChannelId":[19]}}]}}}}]}},"sort":"_id","_source":{"excludes":["orders"]}}
查询结果是nested里面的条件满足一个其他的数据也会返回,通过inner_hits去处理,我想去处理复购的问题,就是通过inner_hits返回的数组长度如果大于就是复购,这个怎么去解决呢?
1 个回复
lijianghu - timesaving
赞同来自:
2:“查询结果是nested里面的条件满足一个其他的数据也会返回”这句话什么意思,是must中有多个条件,还是terms包含多个值?