Skip to content

[UnifiedFieldList] Change icon of field list when mapping changes from unmapped to mapped #221308

Merged
kertal merged 7 commits intoelastic:mainfrom
kertal:discover-fieldlist-vibe-code
May 27, 2025
Merged

[UnifiedFieldList] Change icon of field list when mapping changes from unmapped to mapped #221308
kertal merged 7 commits intoelastic:mainfrom
kertal:discover-fieldlist-vibe-code

Conversation

@kertal
Copy link
Member

@kertal kertal commented May 22, 2025

Summary

Resolves #201751

This PR updates the field list, when a field changes from unmapped to mapped. Due to caching, before this change, the field stayed unmapped, when reloading Discover.

Testing

  • Create a new index in console.
PUT my-index
{
  "mappings": {
    "dynamic": false,
    "properties": {}
  }
}

POST my-index/_doc
{
  "test": "hello world"
}
  • Create data view for the index
  • Go to Discover you will notice that the field is unmapped (which is correct)
  • Now you need to go back to console, to delete the index and recreate it with a different mapping
DELETE my-index

PUT my-index
{
  "mappings": {
    "dynamic": false,
    "properties": {
      "test": {
        "type": "keyword"
      }
    }
  }
}

POST my-index/_doc
{
  "test": "hello world"
}
  • Reload discover - the test field should be mapped correctly, no longer unmapped

Checklist

@kertal kertal self-assigned this May 23, 2025
@kertal kertal changed the title initial vibe coded version May 25, 2025
@kertal
Copy link
Member Author

kertal commented May 26, 2025

/ci

@kertal
Copy link
Member Author

kertal commented May 26, 2025

/ci

@kertal kertal added release_note:fix Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// backport:version Backport to applied version labels v9.1.0 v8.19.0 labels May 27, 2025
@kertal kertal marked this pull request as ready for review May 27, 2025 06:33
@kertal kertal requested a review from a team as a code owner May 27, 2025 06:33
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1013.3KB 1013.3KB +73.0B
lens 1.6MB 1.6MB +73.0B
securitySolution 9.2MB 9.2MB +73.0B
slo 923.8KB 923.8KB +73.0B
total +292.0B

History

cc @kertal

Comment on lines +201 to +205
if (shouldRefresh) {
expect(mockDataViewsService.refreshFields).toHaveBeenCalledWith(mockDataView, false, true);
} else {
expect(mockDataViewsService.refreshFields).not.toHaveBeenCalled();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we split the tests in the ones that refresh and the ones that don't so we keep them without any logic?

@AlexGPlay
Copy link
Contributor

AlexGPlay commented May 27, 2025

going from unmapped to mapped gets fixed with this but going from one mapped type to another is still a problem.
the logic on this part is working but the change is not getting reflected on the available fields, it can be seen here, there request went through, the datatype is updated but the available fields still shows the old one
image

Created an issue for this

@kertal kertal merged commit 62bd0b9 into elastic:main May 27, 2025
11 checks passed
@kertal kertal deleted the discover-fieldlist-vibe-code branch May 27, 2025 13:23
@kertal
Copy link
Member Author

kertal commented May 27, 2025

thx @AlexGPlay !

@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 27, 2025
…m unmapped to mapped (elastic#221308)

When a field changes from unmapped to mapped the field list is updated, before this change it wasn't

(cherry picked from commit 62bd0b9)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 27, 2025
…ges from unmapped to mapped (#221308) (#221622)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[UnifiedFieldList] Change icon of field list when mapping changes
from unmapped to mapped
(#221308)](#221308)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Matthias
Wilhelm","email":"matthias.wilhelm@elastic.co"},"sourceCommit":{"committedDate":"2025-05-27T13:23:25Z","message":"[UnifiedFieldList]
Change icon of field list when mapping changes from unmapped to mapped
(#221308)\n\nWhen a field changes from unmapped to mapped the field list
is updated, before this change it
wasn't","sha":"62bd0b97394516ccbe022daaf85353abd398def3","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:version","v9.1.0","v8.19.0"],"title":"[UnifiedFieldList]
Change icon of field list when mapping changes from unmapped to mapped
","number":221308,"url":"https://github.com/elastic/kibana/pull/221308","mergeCommit":{"message":"[UnifiedFieldList]
Change icon of field list when mapping changes from unmapped to mapped
(#221308)\n\nWhen a field changes from unmapped to mapped the field list
is updated, before this change it
wasn't","sha":"62bd0b97394516ccbe022daaf85353abd398def3"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/221308","number":221308,"mergeCommit":{"message":"[UnifiedFieldList]
Change icon of field list when mapping changes from unmapped to mapped
(#221308)\n\nWhen a field changes from unmapped to mapped the field list
is updated, before this change it
wasn't","sha":"62bd0b97394516ccbe022daaf85353abd398def3"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…m unmapped to mapped (elastic#221308)

When a field changes from unmapped to mapped the field list is updated, before this change it wasn't
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:fix Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.19.0 v9.1.0

4 participants