Kibana visualization error after restoring the snapshot

Hi,
I have restored ElaticSearch snapsot that been managed by another person, I get the followng error when it comes to kibana dashboards

Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [Ligne] in order to load field data by uninverting the inverted index. Note that this can use significant memory.

I understood it should be Ligne.keyword instead of Ligne, but te question for me how it is possible it was working fine before?

Finally when I change Ligne to Ligne.keyword I am getting:

Can't get text on a VALUE_NULL at 1:793

I am on the same version as before 7.16.3

Many thanks for your help

You should look at the index patterns, they should give some information if there's a mismatch on the mapping. Once you find the mismatch try reindexing with the correct mapping by setting a template.

Hi,
Thank you for your reply.
I reviewed the index pattersn and the index mappings of the restored indices. There is no missmatch between them
I am wondering if aggregation on text instead of keyword is possible since I have that in my original kibana visualization?