Kibana cannot list saved_objects. Fielddata is disabled on text fields by default

Create an index pattern. Then go to saved objects - 'Unable find saved objects Error: Bad Request' popup shows up. This request:
/api/kibana/management/saved_objects/_find?perPage=20&page=1&fields=id&type=config&type=map&type=canvas-workpad&type=canvas-element&type=query&type=index-pattern&type=visualization&type=search&type=dashboard&type=url&sortField=type

fails with:
{"message":"all shards failed: [illegal_argument_exception] Fielddata is disabled on text fields by default. Set fielddata=true on [type] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.","statusCode":400,"error":"Bad Request"}

After some digging, I found out that the following query is executed:

> GET /.kibana/_search
> {
>   "query": {
>     "terms": {
>       "type": [
>         "dashboard",
>         "visualization",
>         "search",
>         "index-pattern",
>         "graph-workspace",
>         "timelion-sheet"
>       ]
>     }
>   },
>   "aggs": {
>     "types": {
>       "terms": {
>         "field": "type",
>         "size": 10
>       }
>     }
>   }
> }

against .kibana index with following mapping:

{
  ".kibana" : {
    "mappings" : {
      "properties" : {
        "config" : {
          "properties" : {
            "buildNum" : {
              "type" : "long"
            },
            "defaultIndex" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "index-pattern" : {
          "properties" : {
            "fields" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "timeFieldName" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "title" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "migrationVersion" : {
          "properties" : {
            "index-pattern" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "space" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "namespace" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "space" : {
          "properties" : {
            "_reserved" : {
              "type" : "boolean"
            },
            "color" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "description" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        },
        "telemetry" : {
          "properties" : {
            "enabled" : {
              "type" : "boolean"
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "ui-metric" : {
          "properties" : {
            "count" : {
              "type" : "long"
            }
          }
        },
        "updated_at" : {
          "type" : "date"
        }
      }
    }
  }
}

I wasn't touching the index in any way. Why is the autogenerated setup invalid?
ES and Kibana both 7.4

@KapitanPlaneta Thank you for your question!
This issue appeared in a few discuss posts and the bug was reported in https://github.com/elastic/kibana/issues/40133. A fix was merged for v7.2.0 (https://github.com/elastic/kibana/pull/37674). Since then, a few more reports came in and a new bug was reported for latter versions, including for version 7.4.0. (https://github.com/elastic/kibana/issues/53933). Previous investigations showed that the issue is intermittent and can be resolved locally following the recommendations given here. Please let us know if that helps. If not, please add to the comments in the new bug report for version 7.4.0. Thanks!

@cheiligers

Seems to be working now. I wasn't manually creating new .kibana index nor the mapping. It was recreated with correct type mapping set to keyword.

I will open a bug against 7.4 incase issue happens again.

Thanks for your help.

@KapitanPlaneta I'm glad to hear it's working now! There is already a bug open for the issue against 7.4. Please add your findings to that one.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.