From 01decb1814fbe8852f26854e1ee0f6b620a3556f Mon Sep 17 00:00:00 2001 From: Rishabh Maurya Date: Wed, 20 Mar 2024 18:28:17 -0700 Subject: [PATCH] Add tests for all supported query types for derived fields Signed-off-by: Rishabh Maurya --- .../index/mapper/DerivedFieldMapper.java | 21 +- .../opensearch/index/mapper/ObjectMapper.java | 6 +- .../index/mapper/ParametrizedFieldMapper.java | 4 +- .../mapper/DerivedFieldMapperQueryTests.java | 279 ++++++++++++++++++ .../index/mapper/DerivedFieldMapperTests.java | 57 ++-- .../index/mapper/ObjectMapperTests.java | 3 +- 6 files changed, 326 insertions(+), 44 deletions(-) create mode 100644 server/src/test/java/org/opensearch/index/mapper/DerivedFieldMapperQueryTests.java diff --git a/server/src/main/java/org/opensearch/index/mapper/DerivedFieldMapper.java b/server/src/main/java/org/opensearch/index/mapper/DerivedFieldMapper.java index c02b618bfccd5..5d6d5ad2e73e8 100644 --- a/server/src/main/java/org/opensearch/index/mapper/DerivedFieldMapper.java +++ b/server/src/main/java/org/opensearch/index/mapper/DerivedFieldMapper.java @@ -56,12 +56,7 @@ private static DerivedFieldMapper toType(FieldMapper in) { */ public static class Builder extends ParametrizedFieldMapper.Builder { // TODO: The type of parameter may change here if the actual underlying FieldType object is needed - private final Parameter type = Parameter.stringParam( - "type", - false, - m -> toType(m).type, - "text" - ); + private final Parameter type = Parameter.stringParam("type", false, m -> toType(m).type, "text"); private final Parameter