### Elasticsearch Version

master

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

any

### Problem Description

Currently we are using plain range queries against the BKD tree in all circumstances which can lead to slow queries in some circumstances.  This issue comes from the discussion in this discuss issue:

https://discuss.elastic.co/t/very-slow-search-performance-after-upgrade-to-7-16-1/296152

The reason the query is performing badly is because we are executing a query that is matching many documents on the index which start behaving as a linear scan. This query is used with other conditions so having the queries wrapped with `IndexOrDocValuesQuery` is expected to perform much better.

### Steps to Reproduce

see discuss issue

### Logs (if relevant)

_No response_
server/src/main/java/org/elasticsearch/index/mapper/IpFieldMapper.java
return DocValueFormat.IP.format((BytesRef) value);
        }
        @Override
        public DocValueFormat docValueFormat(@Nullable String format, ZoneId timeZone) {
            checkNoFormat(format);
            checkNoTimeZone(timeZone);
            return DocValueFormat.IP;
        }
        /**
         * @return true if field has been marked as a dimension field
         */
        public boolean isDimension() {
            return isDimension;
        }
    }
    private final boolean indexed;
    private final boolean hasDocValues;
    private final boolean stored;
    private final boolean ignoreMalformed;
    private final boolean dimension;
    private final InetAddress nullValue;
    private final String nullValueAsString;
    private final boolean ignoreMalformedByDefault;
    private final Version indexCreatedVersion;
    private final Script script;
    private final FieldValues<InetAddress> scriptValues;
    private final ScriptCompiler scriptCompiler;
    private IpFieldMapper(String simpleName, MappedFieldType mappedFieldType, MultiFields multiFields, CopyTo copyTo, Builder builder) {
        super(simpleName, mappedFieldType, multiFields, copyTo, builder.script.get() != null, builder.onScriptError.get());
        this.ignoreMalformedByDefault = builder.ignoreMalformedByDefault;