elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.11k stars 24.83k forks source link

Update RestPutMappingAction for deprecation warning for inculde_types #58675

Closed elinamaas closed 4 years ago

elinamaas commented 4 years ago

We receive the deprecation warning "Specifying types in put mapping requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under the type name, and the parameter include_type_name must be provided and set to false.".

There is a corresponding issue. But in one file it is still the same RestPutMappingAction.java:

if (includeTypeName) {
            deprecationLogger.deprecatedAndMaybeLog("put_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
        } else if (type != null || isMappingSourceTyped(MapperService.SINGLE_MAPPING_NAME, sourceAsMap)) {
            throw new IllegalArgumentException("Types cannot be provided in put mapping requests, unless " +
                "the include_type_name parameter is set to true.");
        }

and it is should be changed to

if (request.hasParam(INCLUDE_TYPE_NAME_PARAMETER) == false) {
             deprecationLogger.deprecatedAndMaybeLog("put_mapping_with_types", TYPES_DEPRECATION_MESSAGE);
        }

Elasticsearch 6.8.10 Java 11 Springboot 2.2.7

elasticmachine commented 4 years ago

Pinging @elastic/es-search (:Search/Mapping)

jtibshirani commented 4 years ago

Thanks @elinamaas for reporting this! It looks like we missed the 'put mapping' action in the PR you linked (#38825). I'll open a PR against 6.8 to fix this.

jtibshirani commented 4 years ago

I just merged #38825 to address the issue. It will be available in an upcoming 6.8 patch release.