Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mappings: Allow to force dots in field names #19937

Merged
merged 1 commit into from Aug 11, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -26,6 +26,7 @@
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.CopyOnWriteHashMap;
@@ -61,6 +62,9 @@
public static final String CONTENT_TYPE = "object";
public static final String NESTED_CONTENT_TYPE = "nested";

private static final boolean DOTS_IN_FIELD_ALLOWED = Booleans.parseBooleanExact(
System.getProperty("mapper.allow_dots_in_name", "false"));

public static class Defaults {
public static final boolean ENABLED = true;
public static final Nested NESTED = Nested.NO;
@@ -269,7 +273,7 @@ protected static void parseProperties(ObjectMapper.Builder objBuilder, Map<Strin
while (iterator.hasNext()) {
Map.Entry<String, Object> entry = iterator.next();
String fieldName = entry.getKey();
if (fieldName.contains(".")) {
if (fieldName.contains(".") && DOTS_IN_FIELD_ALLOWED == false) {
throw new MapperParsingException("Field name [" + fieldName + "] cannot contain '.'");
}
// Should accept empty arrays, as a work around for when the
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.