From b1f8fba629d380ca2e1c6de75eb318c3343b902b Mon Sep 17 00:00:00 2001
From: bharath-techie <bharath78910@gmail.com>
Date: Thu, 19 Dec 2024 12:03:03 +0530
Subject: [PATCH] addressing review comments

Signed-off-by: bharath-techie <bharath78910@gmail.com>
---
 .../java/org/opensearch/index/mapper/DocumentParser.java    | 2 +-
 .../java/org/opensearch/index/mapper/MapperService.java     | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java b/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
index d6f298b359afc..70f8ba264931b 100644
--- a/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
+++ b/server/src/main/java/org/opensearch/index/mapper/DocumentParser.java
@@ -664,7 +664,7 @@ private static void parseNonDynamicArray(ParseContext context, ObjectMapper mapp
         // block array values for composite index fields
         if (context.indexSettings().isCompositeIndex()
             && (context.mapperService().isFieldPartOfCompositeIndex(arrayFieldName)
-                || context.mapperService().isCompositeIndexFieldNestedField(context.path().pathAsText(arrayFieldName)))) {
+                || context.mapperService().isFieldPartOfCompositeIndex(context.path().pathAsText(arrayFieldName)))) {
             throw new MapperParsingException(
                 String.format(
                     Locale.ROOT,
diff --git a/server/src/main/java/org/opensearch/index/mapper/MapperService.java b/server/src/main/java/org/opensearch/index/mapper/MapperService.java
index b337dd32cd893..ac204171763e5 100644
--- a/server/src/main/java/org/opensearch/index/mapper/MapperService.java
+++ b/server/src/main/java/org/opensearch/index/mapper/MapperService.java
@@ -707,11 +707,7 @@ private Set<CompositeMappedFieldType> getCompositeFieldTypesFromMapper() {
     }
 
     public boolean isFieldPartOfCompositeIndex(String field) {
-        return fieldsPartOfCompositeMappings.contains(field);
-    }
-
-    public boolean isCompositeIndexFieldNestedField(String field) {
-        return nestedFieldsPartOfCompositeMappings.contains(field);
+        return fieldsPartOfCompositeMappings.contains(field) || nestedFieldsPartOfCompositeMappings.contains(field);
     }
 
     public ObjectMapper getObjectMapper(String name) {