I'm pretty new to programing so my question might be stupid/easy to do but: i need to create multiple filters in elasticsearch based on user input
my body of query:
body = {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term": {name1: value1}},
{"term": {name2: value2}},
{"term": {name3: value3}},
]
}
}
}
},
}
And it works fine but i need to have dynamic number of these filters
I tried to build query into string and then add filters inside but es dont allow it eg:
l = []
for i_type, name in convert.items():
string = '{"term": {"' + i_type + '":"' + name + '"}},'
l.append(string)
i_query = ''.join(l)
when i use list/string in query structure im getting 404 errors from server
Is it even possible to add dynamic number of filters?