Elasticsearch Query using prebuilt list of values

I have a prebuilt list of ip addresses in a seperate file and I was wondering if it is possible to pass these values in that file to the query that uses the filter by the terms (below I want those ip address to be imported from a file)? I have messed around with the multisearch capability but have not been able to get it to work with just passing in a list of these values into a query.

$ curl -XGET http://localhost:9200/ips/_search?pretty -d '{
"version":"true",
"query":{
"constant_score":{
"filter":{
"terms":{
"data":[
"307.121.154.84",
** "142.16.127.132",**
** "132.16.114.138",**
** "197.182.91.243"**
]
}
}
}
},
"sort":[
{
"@timestamp":{
"order":"desc"
}
}
]
}

Two potential options, depending on your requirements.

If you want to store those lists in documents rather than files (e.g. you need these lists for other things), you can use the Lookup functionality of the Terms Query. This will fetch a document, extract the terms from that document, and use that list of terms in the filter. It's sorta like a Subquery in SQL.

The other option is to register your query as a search template, then at query time you can just supply the list of terms as a parameter. Those will be "injected" into the saved query template and executed. This is sorta akin to a prepared statement in SQL.