When using the graph function in kibana, the fielddata error is reported, and the fielddata needs to be changed to ture

Hi guys,

I am new to Kibana, have data loaded into elasticsearch 7.1.1 and using the graph function in kibana 7.1.1 to visualize for connection graph. I want to get like this picture.

But I get the error message:

Error 400 Bad Request: Fielddata is disabled on text fields by default. Set fielddata=true on [host] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a …

I refer to the official website solution

PUT my_index/_mapping/my_type {
  "properties": {
     "my_field": { 
     "type": "text", 
    "fielddata": true 
   }
 } 
}

Then I got another error.

 {
   "error": {
         "root_cause": [
            {
          "type": "illegal_argument_exception",
          "reason": "Types cannot be provided in put mapping requests, unless the include_type_name     parameter is set to true."
            }
           ],
          "type": "illegal_argument_exception",
          "reason": "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
        },
    "status": 400
}

How can I do? Thanks.

Try to remove the "type" from the mapping request.