Skip to content

Commit 6853c9b

Browse files
committed
Address PR comments and add to CHANGELOG
Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
1 parent c69972d commit 6853c9b

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2121
- Tracing for deep search path ([#12103](https://github.com/opensearch-project/OpenSearch/pull/12103))
2222
- Add explicit dependency to validatePom and generatePom tasks ([#12807](https://github.com/opensearch-project/OpenSearch/pull/12807))
2323
- Replace configureEach with all for publication iteration ([#12876](https://github.com/opensearch-project/OpenSearch/pull/12876))
24+
- Derived fields support to derive field values at query time without indexing ([#12569](https://github.com/opensearch-project/OpenSearch/pull/12569))
2425

2526
### Dependencies
2627
- Bump `log4j-core` from 2.18.0 to 2.19.0

server/src/main/java/org/opensearch/index/mapper/DerivedFieldMapper.java

-19
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package org.opensearch.index.mapper;
1010

11-
import org.apache.lucene.document.FieldType;
12-
import org.apache.lucene.index.IndexOptions;
1311
import org.apache.lucene.index.IndexableField;
1412
import org.opensearch.core.xcontent.XContentBuilder;
1513
import org.opensearch.script.Script;
@@ -28,23 +26,6 @@ public class DerivedFieldMapper extends ParametrizedFieldMapper {
2826

2927
public static final String CONTENT_TYPE = "derived";
3028

31-
/**
32-
* Default parameters for the boolean field mapper
33-
*
34-
* @opensearch.internal
35-
*/
36-
public static class Defaults {
37-
public static final FieldType FIELD_TYPE = new FieldType();
38-
39-
static {
40-
FIELD_TYPE.setOmitNorms(true);
41-
FIELD_TYPE.setStored(false);
42-
FIELD_TYPE.setTokenized(false);
43-
FIELD_TYPE.setIndexOptions(IndexOptions.NONE);
44-
FIELD_TYPE.freeze();
45-
}
46-
}
47-
4829
private static DerivedFieldMapper toType(FieldMapper in) {
4930
return (DerivedFieldMapper) in;
5031
}

server/src/main/java/org/opensearch/index/mapper/ObjectMapper.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ protected static boolean parseObjectOrDocumentTypeProperties(
294294
} else if (fieldName.equals("derived")) {
295295
if (fieldNode instanceof Collection && ((Collection) fieldNode).isEmpty()) {
296296
// nothing to do here, empty (to support "derived: []" case)
297-
} else if (!(fieldNode instanceof Map)) {
298-
throw new OpenSearchParseException("derived must be a map type");
299-
} else {
297+
} else if (fieldNode instanceof Map) {
300298
parseDerived(builder, (Map<String, Object>) fieldNode, parserContext);
299+
} else {
300+
throw new OpenSearchParseException("derived must be a map type");
301301
}
302302
return true;
303303
} else if (fieldName.equals("properties")) {

0 commit comments

Comments
 (0)