Is your feature request related to a problem?
As part of #746 , currently FlintOpenSearchMetadataCacheWriter overwrites the index mapping and does not preserve content written by custom implementation of FlintIndexMetadataService (set by spark property spark.datasource.flint.customFlintIndexMetadataServiceClass).
For example, if index already has mappings:
What solution would you like?
Since OpenSearch index mappings only support the PUT api to replace the whole mappings content, in FlintOpenSearchMetadataCacheWriter.updateMetadataCache, we need to
GET current mappings content as json
Add fields for metadata cache to the json
PUT request for the combined json
What alternatives have you considered?
Alternative is to remove FlintOpenSearchMetadataCacheWriter, and instead, have FlintIndexMetadataService take care of the cache write themselves. This approach avoids overwriting as we only update mappings once for each command, instead of twice.
Do you have any additional context?
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? As part of #746 , currently
FlintOpenSearchMetadataCacheWriter
overwrites the index mapping and does not preserve content written by custom implementation ofFlintIndexMetadataService
(set by spark propertyspark.datasource.flint.customFlintIndexMetadataServiceClass
). For example, if index already has mappings:Then the cache writer would overwrite it to
Removing both
_meta.customField1
and_meta.properties.customField2
.The cached fields should be added upon the existing mappings, not replace them. Desired outcome for above example:
What solution would you like? Since OpenSearch index mappings only support the PUT api to replace the whole mappings content, in
FlintOpenSearchMetadataCacheWriter.updateMetadataCache
, we need toWhat alternatives have you considered? Alternative is to remove
FlintOpenSearchMetadataCacheWriter
, and instead, haveFlintIndexMetadataService
take care of the cache write themselves. This approach avoids overwriting as we only update mappings once for each command, instead of twice.Do you have any additional context? Add any other context or screenshots about the feature request here.