Skip to content
Snippets Groups Projects
Commit 2b217627 authored by Dmitriy Rudko's avatar Dmitriy Rudko :speech_balloon:
Browse files

Merge branch 'gcp-nested-arrays-objects' into 'master'

Nested arrays of objects support

See merge request !114
parents 9beaecc9 53d17407
No related branches found
No related tags found
1 merge request!114Nested arrays of objects support
Pipeline #30495 failed
...@@ -208,6 +208,16 @@ public class AttributeParsingServiceImpl implements IAttributeParsingService { ...@@ -208,6 +208,16 @@ public class AttributeParsingServiceImpl implements IAttributeParsingService {
} }
} }
@Override
public void tryParseNested(String recordId, String name, Object value, Map<String, Object> dataMap) {
dataMap.put(name,value);
}
@Override
public void tryParseObject(String recordId, String name, Object value, Map<String, Object> dataMap) {
dataMap.put(name,value);
}
private List<String> isArrayType(Object attributeVal) { private List<String> isArrayType(Object attributeVal) {
try { try {
......
package org.opengroup.osdu.indexer.service; package org.opengroup.osdu.indexer.service;
import org.opengroup.osdu.core.common.model.indexer.IndexSchema;
import java.util.Map; import java.util.Map;
public interface IAttributeParsingService { public interface IAttributeParsingService {
...@@ -26,4 +24,8 @@ public interface IAttributeParsingService { ...@@ -26,4 +24,8 @@ public interface IAttributeParsingService {
void tryParseGeopoint(String recordId, String attributeName, Map<String, Object> storageRecordData, Map<String, Object> dataMap); void tryParseGeopoint(String recordId, String attributeName, Map<String, Object> storageRecordData, Map<String, Object> dataMap);
void tryParseGeojson(String recordId, String attributeName, Object attributeVal, Map<String, Object> dataMap); void tryParseGeojson(String recordId, String attributeName, Object attributeVal, Map<String, Object> dataMap);
void tryParseNested(String recordId, String name, Object value, Map<String, Object> dataMap);
void tryParseObject(String recordId, String name, Object value, Map<String, Object> dataMap);
} }
...@@ -23,6 +23,7 @@ import org.elasticsearch.client.RestHighLevelClient; ...@@ -23,6 +23,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.http.RequestStatus; import org.opengroup.osdu.core.common.model.http.RequestStatus;
import org.opengroup.osdu.core.common.model.indexer.ElasticType;
import org.opengroup.osdu.core.common.model.indexer.IndexSchema; import org.opengroup.osdu.core.common.model.indexer.IndexSchema;
import org.opengroup.osdu.core.common.model.indexer.OperationType; import org.opengroup.osdu.core.common.model.indexer.OperationType;
import org.opengroup.osdu.core.common.model.indexer.StorageType; import org.opengroup.osdu.core.common.model.indexer.StorageType;
...@@ -47,6 +48,10 @@ import java.util.Map; ...@@ -47,6 +48,10 @@ import java.util.Map;
public class IndexSchemaServiceImpl implements IndexSchemaService { public class IndexSchemaServiceImpl implements IndexSchemaService {
private static final String FLATTENED_SCHEMA = "_flattened"; private static final String FLATTENED_SCHEMA = "_flattened";
private static final String WELLBORE_MARKER_SET = "WellboreMarkerSet";
private static final String MARKERS = "Markers";
private static final String WELL_LOG = "WellLog";
private static final String CURVES = "Curves";
private final Gson gson = new Gson(); private final Gson gson = new Gson();
...@@ -228,6 +233,14 @@ public class IndexSchemaServiceImpl implements IndexSchemaService { ...@@ -228,6 +233,14 @@ public class IndexSchemaServiceImpl implements IndexSchemaService {
String kind = schemaObj.getKind(); String kind = schemaObj.getKind();
String type = kind.split(":")[2]; String type = kind.split(":")[2];
//TODO temporary fix for https://community.opengroup.org/osdu/platform/system/indexer-service/-/issues/1
if(data.get(MARKERS) != null){
data.put(MARKERS, ElasticType.NESTED.getValue());
}
if(data.get(CURVES) != null){
data.put(CURVES, ElasticType.NESTED.getValue());
}
return IndexSchema.builder().dataSchema(data).metaSchema(meta).kind(kind).type(type).build(); return IndexSchema.builder().dataSchema(data).metaSchema(meta).kind(kind).type(type).build();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -91,7 +91,11 @@ public class StorageIndexerPayloadMapper { ...@@ -91,7 +91,11 @@ public class StorageIndexerPayloadMapper {
this.attributeParsingService.tryParseGeojson(recordId, name, value, dataMap); this.attributeParsingService.tryParseGeojson(recordId, name, value, dataMap);
break; break;
case NESTED: case NESTED:
this.attributeParsingService.tryParseNested(recordId, name, value, dataMap);
break;
case OBJECT: case OBJECT:
this.attributeParsingService.tryParseObject(recordId, name, value, dataMap);
break;
case UNDEFINED: case UNDEFINED:
// don't do anything for now // don't do anything for now
break; break;
......
...@@ -32,6 +32,8 @@ public class TypeMapper { ...@@ -32,6 +32,8 @@ public class TypeMapper {
private static final Map<String, Object> metaAttributeIndexerType = new HashMap<>(); private static final Map<String, Object> metaAttributeIndexerType = new HashMap<>();
private static final String STORAGE_TYPE_OBJECTS = "[]object";
static { static {
metaAttributeIndexerType.put(RecordMetaAttribute.KIND.getValue(), ElasticType.KEYWORD.getValue()); metaAttributeIndexerType.put(RecordMetaAttribute.KIND.getValue(), ElasticType.KEYWORD.getValue());
...@@ -63,6 +65,9 @@ public class TypeMapper { ...@@ -63,6 +65,9 @@ public class TypeMapper {
storageToIndexerType.put(StorageType.DATETIME_ARRAY.getValue(), ElasticType.DATE_ARRAY.getValue()); storageToIndexerType.put(StorageType.DATETIME_ARRAY.getValue(), ElasticType.DATE_ARRAY.getValue());
storageToIndexerType.put(StorageType.GEO_POINT.getValue(), ElasticType.GEO_POINT.getValue()); storageToIndexerType.put(StorageType.GEO_POINT.getValue(), ElasticType.GEO_POINT.getValue());
storageToIndexerType.put(StorageType.GEO_SHAPE.getValue(), ElasticType.GEO_SHAPE.getValue()); storageToIndexerType.put(StorageType.GEO_SHAPE.getValue(), ElasticType.GEO_SHAPE.getValue());
//TODO temporary fix for https://community.opengroup.org/osdu/platform/system/indexer-service/-/issues/1
storageToIndexerType.put(STORAGE_TYPE_OBJECTS, ElasticType.OBJECT.getValue());
} }
public static String getIndexerType(String storageType) { public static String getIndexerType(String storageType) {
......
...@@ -43,3 +43,4 @@ indexer.que.service.mail=default@iam.gserviceaccount.com ...@@ -43,3 +43,4 @@ indexer.que.service.mail=default@iam.gserviceaccount.com
SCHEMA_HOST=${HOST}/api/schema-service/v1/schema SCHEMA_HOST=${HOST}/api/schema-service/v1/schema
storage-query-kinds-host=https://${STORAGE_HOSTNAME}/api/storage/v2/query/kinds storage-query-kinds-host=https://${STORAGE_HOSTNAME}/api/storage/v2/query/kinds
schema.converter.supported-array-types=boolean,integer,number,string,object
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment