Query string query - including relation in range

I have an index with this mapping:

{
"iprange_index": {
"mappings": {
"properties": {
"iplist": {
"type": "ip_range"
}
}
}
}
}

Now I want to do the following query using query string query.
{
"query": {
"range": {
"iplist": {
"gte": "12.168.1.0",
"lte": "12.168.1.255",
"relation":"contains"
}
}
}
}

Something like this:

{
"query": {
"query_string": {
"query": "iplist:[12.168.1.0 TO 12.168.1.255]"
}
}
}

But I don't know how to incorporate "relation":"contains" in query string query above. Can we do this?

hey,

please take the time to properly format your code snippets. This forums supports markdown so please make use of that. Thanks!

You need to use a range query, as the query string query does not support specifying a relation.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.