Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/elasticsearch): detect sub-properties in 'nested' type mapping #11338

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions metadata-ingestion/src/datahub/ingestion/source/elastic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,31 +138,31 @@ def _get_schema_fields(
for columnName, column in elastic_schema_dict.items():
elastic_type: Optional[str] = column.get("type")
nested_props: Optional[Dict[str, Any]] = column.get(PROPERTIES)
if elastic_type is not None:
self._prefix_name_stack.append(f"[type={elastic_type}].{columnName}")
schema_field_data_type = self.get_column_type(elastic_type)
if nested_props:
self._prefix_name_stack.append(f"[type={PROPERTIES}].{columnName}")
schema_field = SchemaField(
fieldPath=self._get_cur_field_path(),
nativeDataType=elastic_type,
type=schema_field_data_type,
nativeDataType=PROPERTIES,
type=SchemaFieldDataTypeClass(RecordTypeClass()),
description=None,
nullable=True,
recursive=False,
)
yield schema_field
yield from self._get_schema_fields(nested_props)
self._prefix_name_stack.pop()
elif nested_props:
self._prefix_name_stack.append(f"[type={PROPERTIES}].{columnName}")
elif elastic_type is not None:
self._prefix_name_stack.append(f"[type={elastic_type}].{columnName}")
schema_field_data_type = self.get_column_type(elastic_type)
schema_field = SchemaField(
fieldPath=self._get_cur_field_path(),
nativeDataType=PROPERTIES,
type=SchemaFieldDataTypeClass(RecordTypeClass()),
nativeDataType=elastic_type,
type=schema_field_data_type,
description=None,
nullable=True,
recursive=False,
)
yield schema_field
yield from self._get_schema_fields(nested_props)
self._prefix_name_stack.pop()
else:
# Unexpected! Log a warning.
Expand Down
Loading