Hi,
I had to write a query that , where field matches the text , ids is one among the keys in the time dictionary ,
like in this case => items = { "id1": "time1", "id2": "time2".....}
{
"size": 1000,
"_source": [.., .., .. , ..., "timestamp"],
"query": {
"bool": {
"must": [
{"match": {"field": "text"}},
{"terms": {"ids": list(items.keys())}}
],
"filter": [
{"range": {"timestamp": {"gte": <timestamp of matching id> }}}
]
}
}
}
I tried the following :
{
"size": 1000,
"_source": [.., .., .. , .. , "timestamp"],
"query": {
"bool": {
"must": [
{"match": {"field": "text"}},
{"terms": {"ids": list(items.keys())}}
],
"filter": [
{"range": {"date": {"gte": start_date, "lte": end_date}}}
],
"script": {
"script": " doc[timestamp'] >= params.param1 ",
"lang": "painless",
"params": {
"param1": items["doc['ids']"]
}
}
}
}
but it returned improperly configured query.
I am using Elasticsearch 6.3