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

[eem] metadata as keyword #202611

Merged
merged 5 commits into from
Dec 5, 2024
Merged

Conversation

klacabane
Copy link
Contributor

@klacabane klacabane commented Dec 2, 2024

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

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"""
}

@klacabane klacabane self-assigned this Dec 3, 2024
@klacabane klacabane added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Team:obs-entities Observability Entities Team labels Dec 3, 2024
@klacabane klacabane marked this pull request as ready for review December 3, 2024 10:56
@klacabane klacabane requested a review from a team as a code owner December 3, 2024 10:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-entities (Team:obs-entities)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @klacabane

@klacabane klacabane merged commit 58f51fd into elastic:main Dec 5, 2024
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12179256247

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [EEM] Add create and read APIs for v2 type and source definitions (#201470)

Manual backport

To create the backport manually run:

node scripts/backport --pr 202611

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Dec 6, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 202611 locally

@klacabane
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

klacabane added a commit to klacabane/kibana that referenced this pull request Dec 8, 2024
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)
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
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"""
}
```
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
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"""
}
```
klacabane added a commit that referenced this pull request Dec 9, 2024
# 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-->
@kibanamachine kibanamachine added v8.18.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Dec 9, 2024
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 9, 2024
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"""
}
```
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/kibana that referenced this pull request Dec 10, 2024
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"""
}
```
mykolaharmash pushed a commit to mykolaharmash/kibana that referenced this pull request Dec 11, 2024
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"""
}
```
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
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"""
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:obs-entities Observability Entities Team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants