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

expand_dots and object reconstruction #2241

Open
PSeitz opened this issue Nov 7, 2023 · 4 comments
Open

expand_dots and object reconstruction #2241

PSeitz opened this issue Nov 7, 2023 · 4 comments

Comments

@PSeitz
Copy link
Contributor

PSeitz commented Nov 7, 2023

expand_dots Function

When expand_dots_enabled is true, keys with a . are treated as JSON path separators, not as literal periods. For instance, expand_dots_enabled converts {"root": {"child.with.dot": "hello"}} into a nested object: {"root": {"child": {"with": {"dot": "hello"}}}}, making the query root.child.with.dot:hello valid. If false, keys retain their . and must be escaped in queries: root.child\.with\.dot:hello.

Issue

expand_dots_enabled is achieved currently by changing the path stored in inverted index and fast fields.
This will cause issues with object reconstruction from the path (used in #2198)

Instead this could be a query time option, that tries to resolve root.child.with.dot:hello to root.child\.with\.dot:hello, when querying (maybe with metadata created during indexing).

@fulmicoton
Copy link
Collaborator

Is #2198 really the issue you wanted to link? I don't understand how it is related.

@PSeitz
Copy link
Contributor Author

PSeitz commented Nov 15, 2023

I thought that the docvalue_fields option in top_hits reconstructs the object from those fields, but I just found out that's actually not the case and it just returns a flat list instead.

{
  "aggs": {
    "top_tags": {
      "terms": {
        "field": "user.id.keyword",
        "size": 3
      },
      "aggs": {
        "top_sales_hits": {
          "top_hits": {
            "docvalue_fields": [
                  "user.id.keyword",
                  "user.real.name.keyword"
            ],
            "size": 1
          }
        }
      }
    }
  }
}

@ditsuke
Copy link
Contributor

ditsuke commented Nov 16, 2023

Is there still a use-case for this if not in #2198?

@PSeitz
Copy link
Contributor Author

PSeitz commented Nov 16, 2023

Yes, I think we should change it. Currently we change the way paths are stored internally, depending on the expand_dots option.

Internally we should have a canonical way to store paths independently on how they are addressed.

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

No branches or pull requests

3 participants