All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.elastic.clients.elasticsearch.indices.IndexSettingsAnalysis Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to Elasticsearch B.V. under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch B.V. licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package co.elastic.clients.elasticsearch.indices;

import co.elastic.clients.elasticsearch._types.analysis.Analyzer;
import co.elastic.clients.elasticsearch._types.analysis.CharFilter;
import co.elastic.clients.elasticsearch._types.analysis.Normalizer;
import co.elastic.clients.elasticsearch._types.analysis.TokenFilter;
import co.elastic.clients.elasticsearch._types.analysis.Tokenizer;
import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.JsonpSerializable;
import co.elastic.clients.json.JsonpUtils;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.lang.String;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;

//----------------------------------------------------------------
//       THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------

// typedef: indices._types.IndexSettingsAnalysis

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class IndexSettingsAnalysis implements JsonpSerializable {
	private final Map analyzer;

	private final Map charFilter;

	private final Map filter;

	private final Map normalizer;

	private final Map tokenizer;

	// ---------------------------------------------------------------------------------------------

	private IndexSettingsAnalysis(Builder builder) {

		this.analyzer = ApiTypeHelper.unmodifiable(builder.analyzer);
		this.charFilter = ApiTypeHelper.unmodifiable(builder.charFilter);
		this.filter = ApiTypeHelper.unmodifiable(builder.filter);
		this.normalizer = ApiTypeHelper.unmodifiable(builder.normalizer);
		this.tokenizer = ApiTypeHelper.unmodifiable(builder.tokenizer);

	}

	public static IndexSettingsAnalysis of(Function> fn) {
		return fn.apply(new Builder()).build();
	}

	/**
	 * API name: {@code analyzer}
	 */
	public final Map analyzer() {
		return this.analyzer;
	}

	/**
	 * API name: {@code char_filter}
	 */
	public final Map charFilter() {
		return this.charFilter;
	}

	/**
	 * API name: {@code filter}
	 */
	public final Map filter() {
		return this.filter;
	}

	/**
	 * API name: {@code normalizer}
	 */
	public final Map normalizer() {
		return this.normalizer;
	}

	/**
	 * API name: {@code tokenizer}
	 */
	public final Map tokenizer() {
		return this.tokenizer;
	}

	/**
	 * Serialize this object to JSON.
	 */
	public void serialize(JsonGenerator generator, JsonpMapper mapper) {
		generator.writeStartObject();
		serializeInternal(generator, mapper);
		generator.writeEnd();
	}

	protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

		if (ApiTypeHelper.isDefined(this.analyzer)) {
			generator.writeKey("analyzer");
			generator.writeStartObject();
			for (Map.Entry item0 : this.analyzer.entrySet()) {
				generator.writeKey(item0.getKey());
				item0.getValue().serialize(generator, mapper);

			}
			generator.writeEnd();

		}
		if (ApiTypeHelper.isDefined(this.charFilter)) {
			generator.writeKey("char_filter");
			generator.writeStartObject();
			for (Map.Entry item0 : this.charFilter.entrySet()) {
				generator.writeKey(item0.getKey());
				item0.getValue().serialize(generator, mapper);

			}
			generator.writeEnd();

		}
		if (ApiTypeHelper.isDefined(this.filter)) {
			generator.writeKey("filter");
			generator.writeStartObject();
			for (Map.Entry item0 : this.filter.entrySet()) {
				generator.writeKey(item0.getKey());
				item0.getValue().serialize(generator, mapper);

			}
			generator.writeEnd();

		}
		if (ApiTypeHelper.isDefined(this.normalizer)) {
			generator.writeKey("normalizer");
			generator.writeStartObject();
			for (Map.Entry item0 : this.normalizer.entrySet()) {
				generator.writeKey(item0.getKey());
				item0.getValue().serialize(generator, mapper);

			}
			generator.writeEnd();

		}
		if (ApiTypeHelper.isDefined(this.tokenizer)) {
			generator.writeKey("tokenizer");
			generator.writeStartObject();
			for (Map.Entry item0 : this.tokenizer.entrySet()) {
				generator.writeKey(item0.getKey());
				item0.getValue().serialize(generator, mapper);

			}
			generator.writeEnd();

		}

	}

	@Override
	public String toString() {
		return JsonpUtils.toString(this);
	}

	// ---------------------------------------------------------------------------------------------

	/**
	 * Builder for {@link IndexSettingsAnalysis}.
	 */

	public static class Builder extends WithJsonObjectBuilderBase
			implements
				ObjectBuilder {
		@Nullable
		private Map analyzer;

		@Nullable
		private Map charFilter;

		@Nullable
		private Map filter;

		@Nullable
		private Map normalizer;

		@Nullable
		private Map tokenizer;

		/**
		 * API name: {@code analyzer}
		 * 

* Adds all entries of map to analyzer. */ public final Builder analyzer(Map map) { this.analyzer = _mapPutAll(this.analyzer, map); return this; } /** * API name: {@code analyzer} *

* Adds an entry to analyzer. */ public final Builder analyzer(String key, Analyzer value) { this.analyzer = _mapPut(this.analyzer, key, value); return this; } /** * API name: {@code analyzer} *

* Adds an entry to analyzer using a builder lambda. */ public final Builder analyzer(String key, Function> fn) { return analyzer(key, fn.apply(new Analyzer.Builder()).build()); } /** * API name: {@code char_filter} *

* Adds all entries of map to charFilter. */ public final Builder charFilter(Map map) { this.charFilter = _mapPutAll(this.charFilter, map); return this; } /** * API name: {@code char_filter} *

* Adds an entry to charFilter. */ public final Builder charFilter(String key, CharFilter value) { this.charFilter = _mapPut(this.charFilter, key, value); return this; } /** * API name: {@code char_filter} *

* Adds an entry to charFilter using a builder lambda. */ public final Builder charFilter(String key, Function> fn) { return charFilter(key, fn.apply(new CharFilter.Builder()).build()); } /** * API name: {@code filter} *

* Adds all entries of map to filter. */ public final Builder filter(Map map) { this.filter = _mapPutAll(this.filter, map); return this; } /** * API name: {@code filter} *

* Adds an entry to filter. */ public final Builder filter(String key, TokenFilter value) { this.filter = _mapPut(this.filter, key, value); return this; } /** * API name: {@code filter} *

* Adds an entry to filter using a builder lambda. */ public final Builder filter(String key, Function> fn) { return filter(key, fn.apply(new TokenFilter.Builder()).build()); } /** * API name: {@code normalizer} *

* Adds all entries of map to normalizer. */ public final Builder normalizer(Map map) { this.normalizer = _mapPutAll(this.normalizer, map); return this; } /** * API name: {@code normalizer} *

* Adds an entry to normalizer. */ public final Builder normalizer(String key, Normalizer value) { this.normalizer = _mapPut(this.normalizer, key, value); return this; } /** * API name: {@code normalizer} *

* Adds an entry to normalizer using a builder lambda. */ public final Builder normalizer(String key, Function> fn) { return normalizer(key, fn.apply(new Normalizer.Builder()).build()); } /** * API name: {@code tokenizer} *

* Adds all entries of map to tokenizer. */ public final Builder tokenizer(Map map) { this.tokenizer = _mapPutAll(this.tokenizer, map); return this; } /** * API name: {@code tokenizer} *

* Adds an entry to tokenizer. */ public final Builder tokenizer(String key, Tokenizer value) { this.tokenizer = _mapPut(this.tokenizer, key, value); return this; } /** * API name: {@code tokenizer} *

* Adds an entry to tokenizer using a builder lambda. */ public final Builder tokenizer(String key, Function> fn) { return tokenizer(key, fn.apply(new Tokenizer.Builder()).build()); } @Override protected Builder self() { return this; } /** * Builds a {@link IndexSettingsAnalysis}. * * @throws NullPointerException * if some of the required fields are null. */ public IndexSettingsAnalysis build() { _checkSingleUse(); return new IndexSettingsAnalysis(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link IndexSettingsAnalysis} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer .lazy(Builder::new, IndexSettingsAnalysis::setupIndexSettingsAnalysisDeserializer); protected static void setupIndexSettingsAnalysisDeserializer(ObjectDeserializer op) { op.add(Builder::analyzer, JsonpDeserializer.stringMapDeserializer(Analyzer._DESERIALIZER), "analyzer"); op.add(Builder::charFilter, JsonpDeserializer.stringMapDeserializer(CharFilter._DESERIALIZER), "char_filter"); op.add(Builder::filter, JsonpDeserializer.stringMapDeserializer(TokenFilter._DESERIALIZER), "filter"); op.add(Builder::normalizer, JsonpDeserializer.stringMapDeserializer(Normalizer._DESERIALIZER), "normalizer"); op.add(Builder::tokenizer, JsonpDeserializer.stringMapDeserializer(Tokenizer._DESERIALIZER), "tokenizer"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy