Properly search tokens and annotate in matched field
This commit is contained in:
@@ -338,8 +338,15 @@ class ElasticsearchBackend(StorageBackend):
|
||||
{"match_phrase": {"src": source_iter}}
|
||||
)
|
||||
add_top.append(add_top_tmp)
|
||||
if "tokens" in data:
|
||||
add_top_tmp = {"bool": {"should": []}}
|
||||
for token in data["tokens"]:
|
||||
add_top_tmp["bool"]["should"].append(
|
||||
{"match_phrase": {"tokens": token}}
|
||||
)
|
||||
add_top.append(add_top_tmp)
|
||||
for field, values in data.items():
|
||||
if field not in ["source", "index", "tags", "query", "sentiment"]:
|
||||
if field not in ["source", "index", "tags", "query", "sentiment", "tokens"]:
|
||||
for value in values:
|
||||
add_top.append({"match": {field: value}})
|
||||
# Bypass the check for query and tags membership since we can search by msg, etc
|
||||
|
||||
Reference in New Issue
Block a user