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

Support object auto-flattening in the presence of nested and configured objects #108826

Open
salvatore-campagna opened this issue May 20, 2024 · 7 comments

Comments

@salvatore-campagna
Copy link
Contributor

salvatore-campagna commented May 20, 2024

Description

In LogsDB it's desirable to avoid mapping errors through object auto-flattening, similar to subobjects: false, as described in #106812.

However, if sub-objects are disabled by setting subobjects: false it means it is not possible to correctly handled a sub-object field of type nested. This issue arises also because NestedObjectMapper extends ObjectMapper. More so, objects with params like enabled: false are not allowed in the mapping.

A use case where the parent is an object and one or more of its sub-objects are a nested field is quite common also considering that:

  • subobjects: true has always been the default value for fields of type object.
  • a nested field as a sub-object field is typically used to model a one-to-many relationship between the parent field and the sub-object (imagine an exception as the parent object and the stack trace log lines as the sub-object, or an alert firing and the list of rules as sub-obejcts).
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@salvatore-campagna salvatore-campagna added the :Search/Search Search-related issues that do not fall into other categories label May 21, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label May 21, 2024
@salvatore-campagna salvatore-campagna self-assigned this May 21, 2024
@salvatore-campagna
Copy link
Contributor Author

salvatore-campagna commented May 24, 2024

We need to explore the idea of determining the default value to use for subobjects dynamically by setting it to false based on:

  • whether nested field types being used
  • object enabled property being used
  • object dynamic property being used
    We need to to this to guarantee backward compatibility and to make sure we do not break integrations expecting subobjects: true.

@siposea siposea assigned lkts and unassigned salvatore-campagna Jun 4, 2024
@siposea siposea assigned kkrik-es and unassigned lkts Jun 12, 2024
@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types and removed :Search/Search Search-related issues that do not fall into other categories labels Jul 17, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@elasticsearchmachine elasticsearchmachine removed the Team:Search Meta label for search team label Jul 17, 2024
@kkrik-es kkrik-es changed the title subobjects: false and nested sub-object field type Support object auto-flattening in the presence of nested and configured objects Sep 7, 2024
@kkrik-es
Copy link
Contributor

kkrik-es commented Sep 7, 2024

We followed a different approach, introducing a new mode subobjects: auto. This mode applies auto-flattening, similar to subobjects: false, but makes use of any pre-defined objects that can't be flattened, like nested objects and objects with incompatible params.

@javanna javanna removed :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Sep 25, 2024
@flash1293
Copy link
Contributor

@kkrik-es What's the current status of this? It seems like the original PR got reverted due to performance issues and now there is a new PR implementing this which hasn't been merged yet, is that right?

@kkrik-es
Copy link
Contributor

Addressing this is not trivial, so further effort will have to be prioritized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants