Add mapping method back referenced in other repos (#2636)

Signed-off-by: Suraj Singh <surajrider@gmail.com>
This commit is contained in:
Suraj Singh 2022-03-29 09:27:28 -07:00 committed by GitHub
parent d8a1ba6912
commit bcaa06bc0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -249,10 +249,18 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
* Adds mapping that will be added when the index gets created. * Adds mapping that will be added when the index gets created.
* *
* @param source The mapping source * @param source The mapping source
* @param xContentType the content type of the mapping source * @param xContentType The content type of the source
* @deprecated types are being removed */
public CreateIndexRequest mapping(String source, XContentType xContentType) {
return mapping(new BytesArray(source), xContentType);
}
/**
* Adds mapping that will be added when the index gets created.
*
* @param source The mapping source
* @param xContentType the content type of the mapping source
*/ */
@Deprecated
private CreateIndexRequest mapping(BytesReference source, XContentType xContentType) { private CreateIndexRequest mapping(BytesReference source, XContentType xContentType) {
Objects.requireNonNull(xContentType); Objects.requireNonNull(xContentType);
Map<String, Object> mappingAsMap = XContentHelper.convertToMap(source, false, xContentType).v2(); Map<String, Object> mappingAsMap = XContentHelper.convertToMap(source, false, xContentType).v2();