how to set fielddata=true in kibana

前端 未结 5 2213
情话喂你
情话喂你 2020-12-24 10:58

I am new to Kibana, have data loaded into Elastic 5.0.0-alpha3 and am using Kibana 5.0.0-alpha3 to Visualise. I can display some numeric fields as histograms but when I want

5条回答
  •  情书的邮戳
    2020-12-24 11:22

    In your ES mapping, you need to set fielddata:true in your publisher field:

    PUT your_index/_mapping/your_type
    {
       "your_type": {
          "properties": {
            "publisher": {
              "type": "text",
              "fielddata": true
            }
          }
       }
    }
    

    You'll need to reindex your data after making this change, but afterwards Kibana won't complain anymore.

    UPDATE

    You can either execute the above query in the Sense UI or through curl

    curl -XPUT http://localhost:9200/index -d '{
      "mappings": {
        "type": {
          "properties": {
            "publisher": {
              "type": "text",
              "fielddata": true
            }
          }
        }
      }
    }'
    

    Or you can also execute it in your Javascript file just before creating your document:

    client.indices.create({
      index: 'index',
      body: {
          "mappings": {
            "type": {
              "properties": {
                "publisher": {
                  "type": "text",
                  "fielddata": true
                }
              }
            }
          }
        }
    });
    

提交回复
热议问题