There's quite a big difference between your curl query and your JavaScript one. The curl one is pretty easy to read in your post above, but one of many possible queries generated by your JS code looks more like this:
{
"size": 10,
"from": 0,
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "*${input}*",
"fields": ["ilad", "ilcead", "mahad"],
"default_operator": "AND",
},
},
{ "terms": { "zoneid": [] } },
{
"range": {
"kazatarihi": {
"gte": "...",
"lte": "..."
}
}
}
],
"filter": {}
},
},
"sort": [{ "kazatarihi": { "order": "desc" } }]
}
(That doesn't include actual zoneid values or filter clauses.)
My first assumption is that one or more of these query rule differences is filtering out documents you're expecting to see. I would try simplifying your query to more closely match the curl one, and slowly building it back up one query rule at a time to debug which rule is removing the documents you expect, and then inspecting those documents to understand what data they may be missing that filters them out of the results.