forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
86 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
server/src/main/java/org/elasticsearch/index/mapper/DocumentDimensions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.index.mapper; | ||
|
||
import org.apache.lucene.util.BytesRef; | ||
import org.elasticsearch.index.IndexSettings; | ||
|
||
import java.net.InetAddress; | ||
|
||
/** | ||
* Collects dimensions from documents. | ||
*/ | ||
public interface DocumentDimensions { | ||
|
||
/** | ||
* Build an index's DocumentDimensions using its settings | ||
*/ | ||
static DocumentDimensions fromIndexSettings(IndexSettings indexSettings) { | ||
return indexSettings.getMode().buildDocumentDimensions(indexSettings); | ||
} | ||
|
||
/** | ||
* This overloaded method tries to take advantage of the fact that the UTF-8 | ||
* value is already computed in some cases when we want to collect | ||
* dimensions, so we can save re-computing the UTF-8 encoding. | ||
*/ | ||
DocumentDimensions addString(String fieldName, BytesRef utf8Value); | ||
|
||
default DocumentDimensions addString(String fieldName, String value) { | ||
return addString(fieldName, new BytesRef(value)); | ||
} | ||
|
||
DocumentDimensions addIp(String fieldName, InetAddress value); | ||
|
||
DocumentDimensions addLong(String fieldName, long value); | ||
|
||
DocumentDimensions addUnsignedLong(String fieldName, long value); | ||
|
||
DocumentDimensions addBoolean(String fieldName, boolean value); | ||
|
||
DocumentDimensions validate(IndexSettings settings); | ||
|
||
/** | ||
* Noop implementation that doesn't perform validations on dimension fields | ||
*/ | ||
enum Noop implements DocumentDimensions { | ||
|
||
INSTANCE; | ||
|
||
@Override | ||
public DocumentDimensions addString(String fieldName, BytesRef utf8Value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions addString(String fieldName, String value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions addIp(String fieldName, InetAddress value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions addLong(String fieldName, long value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions addUnsignedLong(String fieldName, long value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions addBoolean(String fieldName, boolean value) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public DocumentDimensions validate(IndexSettings settings) { | ||
return this; | ||
} | ||
} | ||
} |
85 changes: 0 additions & 85 deletions
85
server/src/main/java/org/elasticsearch/index/mapper/RoutingFields.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters