[END_OBJECT] but found [FIELD_NAME]')
'[match] malformed query, expected [END_OBJECT] but found [FIELD_NAME]')
解决方法:
改之前:
def query_one(subject_id,start_time,end_time):
query1 ={"query":{"match":{"subject_id":subject_id}},"size": 10000}
# if start_time or end_time:
# ts = {}
# if start_time: ts['gte'] = int(start_time)
# if end_time: ts['lte'] = int(end_time)
# query1["query"]["bool"]={'must':[{"range": {"timestamp": ts}}]}
doc = es.search(index='event_14', doc_type='koala-index', body=query1)
# return doc['aggregations']['group_by_subject_id']
return doc
改过之后:
query1 ={"query":{'bool':{"should":{"match":{"subject_id":subject_id}}
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/84888973
- 点赞
- 收藏
- 关注作者
评论(0)