Problems with "fielddata" : true


#1

Here is my mapping:

PUT bats_analytics
{
  "mappings":{
    "VIDEO":{
      "properties":{
        "total_events":{
          "type": "integer",
          "fielddata": true
          
        },
        "unique_plays":{
          "type": "integer",
          "fielddata": true
        }
        
      }
    }
  }
}

This works without "fielddata": true.
If I try to add it, I get the following error in Kibana:

Discover: Fielddata is disabled on text fields by default. Set fielddata=true on [total_plays] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.


(Mark Walkom) #2

I don't believe you can use fielddata on integers, only docvalues - https://www.elastic.co/guide/en/elasticsearch/reference/5.1/fielddata.html


#3

The reason I'm trying to use it is because in Kibana, when I try to sort by total_plays or unique_plays, I get that error.


(Mark Walkom) #4

Just use docvalues and you will be fine.


#5

I did this and still get the same error:

PUT bats_analytics
{
  "mappings":{
    "VIDEO":{
      "properties":{
        "total_events":{
          "type": "integer",
          "doc_values": true
          
        },
        "unique_plays":{
          "type": "integer",
          "doc_values": true
        }
        
      }
    }
  }
}

Error:

Discover: Fielddata is disabled on text fields by default. Set fielddata=true on [total_plays] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.


(Mark Walkom) #6

Did you reindex?


#7

Yes, I did.


#8

In the end, this is what works:

PUT bats_analytics
{
  "mappings":{
    "VIDEO":{
      "properties":{
        "total_plays":{
          "type": "integer"
          
        },
        "unique_plays":{
          "type": "integer"
        },
        "presentation_title":{
          "type" : "string",
          "index":"not_analyzed",
          "doc_values":true
        },"presentation_id":{
          "type" : "string",
           "index":"not_analyzed",
          "doc_values":true
        }
        
      }
    }
  }
}

Had to use "index" : "not_analyzed" in order add in "doc_values" : true.
The two go hand in hand. I think.


(system) #9

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