This is an automated email from the ASF dual-hosted git repository.
lide pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new c9d31e0d2f1 [fix](es) fix querying the index (#36319)
c9d31e0d2f1 is described below
commit c9d31e0d2f154391f8cfff356dca93dbf7158305
Author: lw112 <[email protected]>
AuthorDate: Fri Jun 14 18:57:10 2024 +0800
[fix](es) fix querying the index (#36319)
---
.../java/org/apache/doris/external/elasticsearch/EsUtil.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
index f2980133528..514c06206c3 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsUtil.java
@@ -39,6 +39,9 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.stream.StreamSupport;
/**
* Util for ES, some static method.
@@ -110,15 +113,16 @@ public class EsUtil {
// remove dynamic templates, for ES 7.x and 8.x
checkNonPropertiesFields(mappings, arrayFields);
String firstType = mappings.fieldNames().next();
- if (!"properties".equals(firstType)) {
- // If type is not passed in takes the first type.
+ if (StreamSupport.stream(Spliterators
+ .spliteratorUnknownSize(mappings.fieldNames(),
Spliterator.ORDERED), false)
+ .anyMatch(s -> s.contains("properties"))) {
+ return mappings;
+ } else {
ObjectNode firstData = (ObjectNode) mappings.get(firstType);
// check for ES 6.x and before
checkNonPropertiesFields(firstData, arrayFields);
return firstData;
}
- // Equal 7.x and after
- return mappings;
} else {
if (mappings.has(mappingType)) {
ObjectNode jsonData = (ObjectNode) mappings.get(mappingType);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]