Skip to content

Commit

Permalink
HSEARCH-2387 Add dynamic mapping index property
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Dec 16, 2016
1 parent 0c37e61 commit a8e6764
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
@@ -0,0 +1,35 @@
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.elasticsearch.cfg;

/**
* Configuration values for Elasticsearch "dynamic" attribute values.
* <p>
* Defines the behaviour when a document contains an unrecognized field.
*
* @see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html">Elasticsearch mapping:
* dynamic</a>
*
* @author Davide D'Alto
*/
public enum DynamicType {

/**
* Add unrecognized fields to the schema
*/
TRUE,

/**
* Ignore unrecognized field
*/
FALSE,

/**
* Throw exception when the field is unrecognized
*/
STRICT;
}
Expand Up @@ -18,6 +18,7 @@ public final class ElasticsearchEnvironment {
*/
public static final class Defaults {

public static final DynamicType DYNAMIC_MAPPING = DynamicType.STRICT;
public static final String SERVER_URI = "http://localhost:9200";
public static final int SERVER_READ_TIMEOUT = 60000;
public static final int SERVER_CONNECTION_TIMEOUT = 3000;
Expand Down Expand Up @@ -223,6 +224,21 @@ public static final class Defaults {
*/
public static final String SCROLL_TIMEOUT = "elasticsearch.scroll_timeout";

/**
* Property for specifying the behaviour when Elasticsearch encounters a previously unknown field in a document.
* <p>
* Possible values are:
* <p>
* <ul>
* <li>{@code true}: Add new fields dynamically</li>
* <li>{@code false}: Ignore new fields</li>
* <li>{@code strict}: Throw an exception if an unknown field is encountered</li>
* </ul>
* <p>
* Defaults to {@code strict}.
*/
public static final String DYNAMIC_MAPPING = "elasticsearch.dynamic_mapping";

private ElasticsearchEnvironment() {
}
}

0 comments on commit a8e6764

Please sign in to comment.