Is there a way to check if a value exists in Druid datasource dimension/column?

Hello Forum!

Which query type should we use to check if an array of values exists in a druid column? I tried GroupBy but its not performant, and Timeseries queries are highly performant but they don’t return dimension value to map and determine if the value exists. We can use TopN which is also highly performant but it doesn’t support multi-dimension searches. Any suggestions here? Any help is highly appreciated. Thank you.

Groupby Query

{
  "queryType": "groupBy",
  "dataSource": "marketing",
  "granularity": "all",
  "dimensions": [
    "domain", "ip_address"
  ],
  "intervals": [ "2012-01-01T00:00:00.000/2023-01-03T00:00:00.000" ],
  "filter": {
    "type": "or",
    "fields": [
      {
        "type": "in",
        "dimension": "domain",
        "values": [
          "example.com",
          "helloworld.me"
        ]
      },
      {
        "type": "in",
        "dimension": "ip_address",
        "values": [
          "10.1.22.3",
          "54.23.43.10"
        ]
      }
    ]
  }
}

Timeseries Query (Queried dimensions are not returned, so cannot use this query)

{
  "queryType": "timeseries",
  "dataSource": "marketing",
  "granularity": "all",
  "intervals": "2022-05-15T21:16:04.658Z/2022-11-15T21:16:04.658Z",
  "filter": {
    "type": "or",
    "fields": [
      {
        "type": "selector",
        "dimension": "domain",
        "value": "imply.com"
      },
      {
        "type": "selector",
        "dimension": "domain",
        "value": "example.com"
      }
    ]
  },
  "aggregations": [
    {
      "type": "longMin",
      "fieldName": "__time",
      "name": "earliest"
    },
    {
      "type": "longMax",
      "fieldName": "__time",
      "name": "latest"
    }
  ],
  "context": {
    "defaultTimeout": 300000,
    "skipEmptyBuckets": "true"
  }
}