-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[eem] metadata as keyword #202611
[eem] metadata as keyword #202611
Conversation
Pinging @elastic/obs-entities (Team:obs-entities) |
💚 Build Succeeded
Metrics [docs]
History
cc @klacabane |
Starting backport for target branches: 8.x |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` (cherry picked from commit 58f51fd)
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
# Backport This will backport the following commits from `main` to `8.x`: - [[eem] metadata as keyword (#202611)](#202611) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kevin Lacabane","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-05T11:57:12Z","message":"[eem] metadata as keyword (#202611)\n\nCast identity fields and metadata fields as keyword to prevent ambiguous\r\nmappings error\r\n\r\n### Testing\r\n\r\n- setup data\r\n```\r\nPUT service-name-as-keyword\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"keyword\"\r\n }\r\n }\r\n }\r\n}\r\n\r\nPOST service-name-as-keyword/_doc\r\n{\r\n \"service.name\": \"as-keyword\"\r\n}\r\n\r\nPUT service-name-as-text\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"text\"\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nPOST service-name-as-text/_doc\r\n{\r\n \"service.name\": \"as-text\"\r\n}\r\n```\r\n\r\n- data loads successfully in `/app/entity_manager`\r\n![Screenshot 2024-12-03 at 11 50\r\n10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff)\r\n\r\n_new query_\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```\r\n\r\n- previous query fails with ambiguous mappings error\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```","sha":"58f51fdac79937cd3706c9f202e460b7a568fc12","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport missing","v9.0.0","backport:prev-minor","Team:obs-entities"],"number":202611,"url":"https://github.com/elastic/kibana/pull/202611","mergeCommit":{"message":"[eem] metadata as keyword (#202611)\n\nCast identity fields and metadata fields as keyword to prevent ambiguous\r\nmappings error\r\n\r\n### Testing\r\n\r\n- setup data\r\n```\r\nPUT service-name-as-keyword\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"keyword\"\r\n }\r\n }\r\n }\r\n}\r\n\r\nPOST service-name-as-keyword/_doc\r\n{\r\n \"service.name\": \"as-keyword\"\r\n}\r\n\r\nPUT service-name-as-text\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"text\"\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nPOST service-name-as-text/_doc\r\n{\r\n \"service.name\": \"as-text\"\r\n}\r\n```\r\n\r\n- data loads successfully in `/app/entity_manager`\r\n![Screenshot 2024-12-03 at 11 50\r\n10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff)\r\n\r\n_new query_\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```\r\n\r\n- previous query fails with ambiguous mappings error\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```","sha":"58f51fdac79937cd3706c9f202e460b7a568fc12"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202611","number":202611,"mergeCommit":{"message":"[eem] metadata as keyword (#202611)\n\nCast identity fields and metadata fields as keyword to prevent ambiguous\r\nmappings error\r\n\r\n### Testing\r\n\r\n- setup data\r\n```\r\nPUT service-name-as-keyword\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"keyword\"\r\n }\r\n }\r\n }\r\n}\r\n\r\nPOST service-name-as-keyword/_doc\r\n{\r\n \"service.name\": \"as-keyword\"\r\n}\r\n\r\nPUT service-name-as-text\r\n{\r\n \"mappings\": {\r\n \"dynamic\": false,\r\n \"properties\": {\r\n \"service.name\": {\r\n \"type\": \"text\"\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\nPOST service-name-as-text/_doc\r\n{\r\n \"service.name\": \"as-text\"\r\n}\r\n```\r\n\r\n- data loads successfully in `/app/entity_manager`\r\n![Screenshot 2024-12-03 at 11 50\r\n10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff)\r\n\r\n_new query_\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```\r\n\r\n- previous query fails with ambiguous mappings error\r\n```\r\nPOST _query\r\n{\r\n \"query\": \"\"\"FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = \"service\", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10\"\"\"\r\n}\r\n```","sha":"58f51fdac79937cd3706c9f202e460b7a568fc12"}}]}] BACKPORT-->
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error ### Testing - setup data ``` PUT service-name-as-keyword { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "keyword" } } } } POST service-name-as-keyword/_doc { "service.name": "as-keyword" } PUT service-name-as-text { "mappings": { "dynamic": false, "properties": { "service.name": { "type": "text" } } } } POST service-name-as-text/_doc { "service.name": "as-text" } ``` - data loads successfully in `/app/entity_manager` ![Screenshot 2024-12-03 at 11 50 10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff) _new query_ ``` POST _query { "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ``` - previous query fails with ambiguous mappings error ``` POST _query { "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10""" } ```
Cast identity fields and metadata fields as keyword to prevent ambiguous mappings error
Testing
/app/entity_manager
new query