Is it possible to filter against a list?

If I have a list of host names, how could I filter data from a bucket of data for all hosts in that list?

I could put them into a variable using the CSV method. How would I filter data for all hosts in the list ? or host A against host B?

Would I need to make another bucket with just the list so I join this to the other bucket ?

Or could I just add a record to the current bucket that I could filter out using a tag? then use that to create a table/list to join to the data? how would I create such a record and insert it into the bucket ?

The scheme looks something like:

Select Fiields from BucketOfServerData where Server in ( Select Server fromServerBucket).

I can’t help you with the flux syntax as I am a newbie.

This is NOT the way to do it!

I am using version 2 OSS which only uses influxQL language, and looking thought the manual it doesn’t appear to have an SQL like “in” list or a JavaScript foreach/for loop over an array which could be put in a influx custom function?
Also I would want to use this on each graph in the dashboard, so would be nicer if it was global to the dashboard.

Where do I put the list ? this is because this is not in the database atm?

I want to be able to do things like compare container metrics for container A on host A to container F on host A where I have set up all containers with the same config to push into the same containers bucket as each gets tagged by telegraf with its host name but not that of the host server name. I can then supply a list or containers on that host. Or even better another bucket filled by the hosts with which containers are on which hosts ? but I am unsure how to got about writing such a scripts, I can create a list of containers from a bash script but don’t know how I would use telegraf with that data to enter into the influxDB

This looks like the way forward.
if I develop a script to parse the containers on a host an push into influx.

One record with all the containers as tags or lots of records and one container as a tag?

curl --request POST "http://localhost:8086/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \
  --header "Authorization: Token YOURAUTHTOKEN" \
  --data-raw "
mem,host=host1 used_percent=23.43234543 1556896326
mem,host=host2 used_percent=26.81522361 1556896326
mem,host=host1 used_percent=22.52984738 1556896336
mem,host=host2 used_percent=27.18294630 1556896336