Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field data loading is forbidden on [FIELDNAME] #15267

Closed
velion opened this issue Dec 6, 2015 · 43 comments
Closed

Field data loading is forbidden on [FIELDNAME] #15267

velion opened this issue Dec 6, 2015 · 43 comments

Comments

@velion
Copy link

velion commented Dec 6, 2015

when i Click “visualize” and then ,display error "Visualize:java.lang.lllegalStateException:Field daVisualize",or i used dashboard module ,before logstash auto update index,it was normal;when time is 8:00 am,dashboard module will not work,and display the error.

error details:

1.kibana page error:
Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on path"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"logstash-2015.11.29","node":"ODyds4KgQsqrxczx1ana8A","reason":{"type":"exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on path","caused_by":{"type":"unchecked_execution_exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on path","caused_by":{"type":"illegal_state_exception","reason":"Field data loading is forbidden on path"}}}}]}} KbnError@http://www.xxx.cn:80/bundles/c ... 64:30 RequestFailure@http://www.xxx.cn:80/bundles/c ... 97:19 http://www.xxx.cn:80/bundles/k ... 05:57 http://www.xxx.cn:80/bundles/c ... 91:28 http://www.xxx.cn:80/bundles/c ... 60:31 map@[native code] map@http://www.xxx.cn:80/bundles/c ... 59:34 callResponseHandlers@http://www.xxx.cn:80/bundles/k ... 77:26 http://www.xxx.cn:80/bundles/k ... 84:37 processQueue@http://www.xxx.cn:80/bundles/c ... 09:31 http://www.xxx.cn:80/bundles/c ... 25:40 $eval@http://www.xxx.cn:80/bundles/c ... 53:29 $digest@http://www.xxx.cn:80/bundles/c ... 64:37 $apply@http://www.xxx.cn:80/bundles/c ... 61:32 done@http://www.xxx.cn:80/bundles/c ... 10:54 completeRequest@http://www.xxx.cn:80/bundles/c ... 08:16 requestLoaded@http://www.xxx.cn:80/bundles/commons.bundle.js:37749:25

2.elasticsearch error log:

[2015-11-30 00:04:53,395][DEBUG][action.search.type ] [Thumbelina] [logstash-2015.11.29][2], node[acrTX4O0RciN8ppbSdfoww], [P], v[4], s[STARTED], a[id=ogwkZP0yQCCgatW0_tnvnw]: Failed to execute [org.elasticsearch.action.search.SearchRequest@aef2ffe] lastShard [true]
RemoteTransportException[[Thumbelina][192.168.1.76:9300][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: IllegalStateException[Field data loading is forbidden on response];
Caused by: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: IllegalStateException[Field data loading is forbidden on response];
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:343)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:106)
at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:363)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:375)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
at org.elasticsearch.shield.transport.ShieldServerTransportService$ProfileSecuredRequestHandler.messageReceived(ShieldServerTransportService.java:165)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on response]; nested: IllegalStateException[Field data loading is forbidden on response];
at org.elasticsearch.index.fielddata.plain.AbstractIndexFieldData.load(AbstractIndexFieldData.java:82)
at org.elasticsearch.search.aggregations.support.ValuesSource$Bytes$FieldData.bytesValues(ValuesSource.java:195)
at org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregator.getLeafCollector(StringTermsAggregator.java:73)
at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:132)
at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:38)
at org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:117)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:763)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:486)
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:324)
... 11 more
Vian 00:18:36
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Field data loading is forbidden on response
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache.load(IndicesFieldDataCache.java:156)
at org.elasticsearch.index.fielddata.plain.AbstractIndexFieldData.load(AbstractIndexFieldData.java:76)
… 19 more
Caused by: java.lang.IllegalStateException: Field data loading is forbidden on response
at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.fail(DisabledIndexFieldData.java:68)
at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.loadDirect(DisabledIndexFieldData.java:54)
at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache$1.call(IndicesFieldDataCache.java:163)
at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache$1.call(IndicesFieldDataCache.java:156)
at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
… 23 more

@mirnujAtom
Copy link

Having the same issue: kibana 4.3, elasticsearch 2.1.0
On a testing server it works fine, the only difference I see is java version, 1.8.0_40 on testing and 1.8.0_65 on a problem one.

@Isabaellchen
Copy link

Same here, had to re-index with the same data twice, because a shutdown caused my translogs to be corrupted, now, the second time, i get "Field data loading is forbidden on timestamp" when i want to do anything in kibana... Had this error before on other fields, which i circled around by using raw fields. Maybe i am managing my data in an undesired way (different indeces for different parts of our architecture each split by date again, yes templates are present and i can use raw fields as well as geoip data, so this shouldnt be a problem). Standalone usage btw. on java 1.8.0_45

[2015-12-09 16:26:42,037][DEBUG][action.search.type       ] [White Tiger] [apache-inter-2015.11.28][2], node[kxW8JOWWQSCBtblWQkggKA], [P], v[2], s[STARTED], a[id=6WMOShhmQ9eeY9wKDH9FVA]: Failed to execute [org.elasticsearch.action.search.SearchRequest@4737155a] lastShard [true]
RemoteTransportException[[White Tiger][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: SearchParseException[failed to parse search source [{"size":500,"sort":[{"timestamp":{"order":"desc","unmapped_type":"boolean"}}],"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1446332400000,"lte":1448924399999,"format":"epoch_millis"}}}],"must_not":[]}}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}},"require_field_match":false,"fragment_size":2147483647},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"12h","time_zone":"Europe/Berlin","min_doc_count":0,"extended_bounds":{"min":1446332400000,"max":1448924399999}}}},"fields":["*","_source"],"script_fields":{},"fielddata_fields":["@timestamp","parameters.kw_termin"]}]]; nested: IllegalStateException[Field data loading is forbidden on timestamp];
Caused by: SearchParseException[failed to parse search source [{"size":500,"sort":[{"timestamp":{"order":"desc","unmapped_type":"boolean"}}],"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1446332400000,"lte":1448924399999,"format":"epoch_millis"}}}],"must_not":[]}}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}},"require_field_match":false,"fragment_size":2147483647},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"12h","time_zone":"Europe/Berlin","min_doc_count":0,"extended_bounds":{"min":1446332400000,"max":1448924399999}}}},"fields":["*","_source"],"script_fields":{},"fielddata_fields":["@timestamp","parameters.kw_termin"]}]]; nested: IllegalStateException[Field data loading is forbidden on timestamp];
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:848)
    at org.elasticsearch.search.SearchService.createContext(SearchService.java:651)
    at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:617)
    at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:368)
    at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
    at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
    at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Field data loading is forbidden on timestamp
    at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.fail(DisabledIndexFieldData.java:68)
    at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.comparatorSource(DisabledIndexFieldData.java:64)
    at org.elasticsearch.search.sort.SortParseElement.addSortField(SortParseElement.java:255)
    at org.elasticsearch.search.sort.SortParseElement.addCompoundSortField(SortParseElement.java:189)
    at org.elasticsearch.search.sort.SortParseElement.parse(SortParseElement.java:87)
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:831)
    ... 10 more

@alexzhuustc
Copy link

I have the same issue.
logstash-2.1.0-1.noarch
elasticsearch-2.1.0-1.noarch
kibana-4.3.0-linux-x64

Just a simplest sample data set.

@cybacolt
Copy link

same issue here:
Ubuntu 14.04
logstash 2.1.0-1
elasticsearch 2.1.0
Kibana 4.3.0 build 9369

i've also tried restarting all services and reindexing on elasticsearch. permissions on /var/lib/elasticsearch look fine.

i'll try rolling elastic back to an earlier version shortly.

Kibana error:

Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on message"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"logstash-2015.12.10","node":"wRLwuXSsSv2M0sKnxPR56g","reason":{"type":"exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on message","caused_by":{"type":"unchecked_execution_exception","reason":"java.lang.IllegalStateException: Field data loading is forbidden on message","caused_by":{"type":"illegal_state_exception","reason":"Field data loading is forbidden on message"}}}}]}}
    at http://xxxxx/bundles/kibana.bundle.js:78760:39
    at Function.Promise.try (http://xxxxx/bundles/commons.bundle.js:60967:23)
    at http://xxxxx/bundles/commons.bundle.js:60936:31
    at Array.map (native)
    at Function.Promise.map (http://xxxxx/bundles/commons.bundle.js:60935:31)
    at callResponseHandlers (http://xxxxx/bundles/kibana.bundle.js:78732:23)
    at http://xxxxx/bundles/kibana.bundle.js:78239:17
    at processQueue (http://xxxxx/bundles/commons.bundle.js:42339:29)
    at http://xxxxx/bundles/commons.bundle.js:42355:28
    at Scope.$eval (http://xxxxx/bundles/commons.bundle.js:43583:29)

elasticsearch log error:

        ... 22 more
[2015-12-10 14:06:32,799][DEBUG][action.search.type       ] [Brother Voodoo] All shards failed for phase: [query]
RemoteTransportException[[Brother Voodoo][localhost/127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: IllegalStateException[Field data loading is forbidden on message];
Caused by: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: IllegalStateException[Field data loading is forbidden on message];
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:343)
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:106)
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:363)
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:375)
        at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
        at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
        at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: ElasticsearchException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: UncheckedExecutionException[java.lang.IllegalStateException: Field data loading is forbidden on message]; nested: IllegalStateException[Field data loading is forbidden on message];
        at org.elasticsearch.index.fielddata.plain.AbstractIndexFieldData.load(AbstractIndexFieldData.java:82)
        at org.elasticsearch.search.aggregations.support.ValuesSource$Bytes$FieldData.bytesValues(ValuesSource.java:195)
        at org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregator.getLeafCollector(StringTermsAggregator.java:73)
        at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:132)
        at org.elasticsearch.search.aggregations.AggregatorBase.getLeafCollector(AggregatorBase.java:38)
        at org.apache.lucene.search.MultiCollector.getLeafCollector(MultiCollector.java:117)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:763)
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:486)
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:324)
        ... 10 more
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Field data loading is forbidden on message
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
        at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
        at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache.load(IndicesFieldDataCache.java:156)
        at org.elasticsearch.index.fielddata.plain.AbstractIndexFieldData.load(AbstractIndexFieldData.java:76)
        ... 18 more
Caused by: java.lang.IllegalStateException: Field data loading is forbidden on message
        at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.fail(DisabledIndexFieldData.java:68)
        at org.elasticsearch.index.fielddata.plain.DisabledIndexFieldData.loadDirect(DisabledIndexFieldData.java:54)
        at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache$1.call(IndicesFieldDataCache.java:163)
        at org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache$IndexFieldCache$1.call(IndicesFieldDataCache.java:156)
        at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
        ... 22 more

@cybacolt
Copy link

this seems to have had a good outcome (visualizations are working, at least atm)... be aware this will wipe all previous index data:

service elasticsearch stop
service logstash stop
apt-cache remove elasticsearch
mv /var/lib/elasticsearch /var/lib/elasticsearch.back
apt-get install elasticsearch=2.0.1
service elasticsearch restart
service logstash restart

then repeat these steps to reinstall 2.1.0 with the good 2.0.1 /var/lib/elasticsearch contents.

perhaps i'd broken my indexes somehow... not sure... eitherway, its working atm.

@parberge
Copy link

I have the same issue:
centos7
logstash-2.1.1-1.noarch
elasticsearch-2.1.0-1.noarch
kibana 4.3.0 Build 9369

EDIT: Like @mirnujAtom I also use java 1.8.0_65

@Isabaellchen
Copy link

@cybacolt
What do you mean with "the good 2.0.1 /var/lib/elasticsearch content"? I am using a downloaded binary package. Is that stuff cached somewhere outside of my unzipped folder? /var/lib/elasticsearch does not exist here.

@mirnujAtom
Copy link

Fixed my problem with similar to what @cybacolt suggested - moved /var/lib/elasticsearch from a working server (which was upgraded from 2.0 to 2.1) and dropped all data it used to have.
Looks like there is an issue if you do a fresh install of elastic2.1

@Isabaellchen there is a variable called path.data: in elasticsearch.yml, check where does it refer to in your configuration.

@PhaedrusTheGreek PhaedrusTheGreek changed the title Field data loading is forbidden on path Field data loading is forbidden on [FIELDNAME] Dec 10, 2015
@PhaedrusTheGreek
Copy link
Contributor

The problem happens when "fielddata" : { "format" : "disabled" } is set in a field's mapping, which is the default as of Logstash 2.1, due to this issue.

Common Variations of this error:

  • Field data loading is forbidden on type
  • Field data loading is forbidden on path
  • Field data loading is forbidden on host

In default Logstash 2.1 with Kibana 4.3+, it may come down to the fact that you have visualizing on an analyzed field.

screen shot 2015-12-10 at 10 11 22 am

Running an aggregation on an analyzed field will produce the same error:

GET logstash-2015.12.10/_search
{
   "size": 0, 
   "aggregations": {
      "the_test": {
         "terms": {
            "field": "host"
         }
      }
   }
}

One should be able to solve the problem by using the .raw version of the field instead.

Wiping the /var/lib/elasticsearch directory also deletes the index templates which are installed by Logstash, so that might explain why previous comments were able to workaround by doing this.

@Isabaellchen
Copy link

As stated above, i received the error on the timestamp field, rendering kibana completely infunctional until i reindexed. Also, i had the same data indexed before, without receiving this error, until my translogs got corrupted and i had to start from scratch.

@PhaedrusTheGreek
Copy link
Contributor

@Isabaellchen are you using Logstash? I'm wondering because Logstash uses the @timestamp field, whereas your error shows just timestamp (without the @ symbol). Did your timestamp field's mapping happen to have "fielddata" : { "format" : "disabled" } set ?

@Raggyman
Copy link

A similar things happen if the field is a string. In my case I have JSON that is inserted and when trying to get a unique count it fails. This is with all the latest production versions.

@vianer
Copy link

vianer commented Dec 11, 2015

thanks @PhaedrusTheGreek ,through using the .raw version of the field instead,i solution the problem.

@Isabaellchen
Copy link

@PhaedrusTheGreek
Thanks for your reply. Yes i am using logstash.
Since i am reading jboss files, i generated the timestamp from the filename and the logline, thus creating an extra timestamp field to be parsed by the date filter. Maybe i accidentally chose that field for my indeces on accident, i can not check that anymore. "fielddata" : { "format" : "disabled" } however, was not set in my template.

@clintongormley
Copy link
Contributor

This is not a bug. It is a safeguard. The logstash template now disables fielddata loading where it makes sense, eg see https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/master/lib/logstash/outputs/elasticsearch/elasticsearch-template.json#L15

You get this message when you try to sort or run aggregations or scripts on analyzed fields. Fulfilling this request would cause massive amounts of memory usage on your cluster, and it almost certainly isn't what you want anyway, eg Field data loading is forbidden on path"... You don't want to aggregate on the analyzed field path, you want to aggregate on the not analyzed field path.raw, which uses doc values not heap memory.

This is by design.

@yodog
Copy link

yodog commented Jan 13, 2016

the good old 'its not a bug, its a feature' :)

but seriously, this kind of change breaks the application to the point where we have to reindex our data.

besides the 'breaking changes' section, where else should i look before updating?

@argais
Copy link

argais commented Jan 20, 2016

Now how do we turn off this safeguard so we can keep using the solutions we had in place before without changing them?

@clintongormley
Copy link
Contributor

@argais you can do it by updating the mapping for string fields as follows:

PUT my_index/_mapping/my_type
{
  "properties": {
    "text": {
      "type": "string",
      "fielddata": {
        "format": "paged_bytes"
      }
    }
  }
}

@dkirrane
Copy link

This is happening when I sort on a column in the Kibana Discover page.
And there are no raw fields to add to the table. I can add path field for instance but not path.raw
So anytime I sort of path I get this exception

@xamox
Copy link

xamox commented Jan 28, 2016

I am also getting this using:
Official docker image Elasticsearch 2.1 as well as official docker image 2.1. And Kibana 4.3.1.

I'm just testing with basic example from here:
https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html

Full error:

Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"illegal_state_exception","reason":"Field data loading is forbidden on timestamp"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"logstash-2016.01.28","node":"X3VNkMLlTgOuY0w1BGYTzA","reason":{"type":"illegal_state_exception","reason":"Field data loading is forbidden on timestamp"}}]}}
    at http://localhost:5601/bundles/kibana.bundle.js:89030:39
    at Function.Promise.try (http://localhost:5601/bundles/commons.bundle.js:63741:23)
    at http://localhost:5601/bundles/commons.bundle.js:63710:31
    at Array.map (native)
    at Function.Promise.map (http://localhost:5601/bundles/commons.bundle.js:63709:31)
    at callResponseHandlers (http://localhost:5601/bundles/kibana.bundle.js:89002:23)
    at http://localhost:5601/bundles/kibana.bundle.js:88507:17
    at processQueue (http://localhost:5601/bundles/commons.bundle.js:41837:29)
    at http://localhost:5601/bundles/commons.bundle.js:41853:28
    at Scope.$eval (http://localhost:5601/bundles/commons.bundle.js:43081:29)

@wdtmatt
Copy link

wdtmatt commented Feb 4, 2016

So in the use case below, what would be the appropriate solution with this new feature?

I'm using logstash to parse web logs. I use kv to capture all the query strings, which in one case is a comma separated list which gets stored as string in elasticsearch, eg layers.raw:"w,x,y,z" The results for each log entry could be any combination of w,x,y,z or all of them. I was building my vizualization off the analyzed field "layers", because I could get a count of each call of w. That is no longer possible with this issue.

@soichih
Copy link

soichih commented Feb 8, 2016

I've been hit by this issue for the last couple of weeks, and I still can't figure out what exactly I need to do to fix it.. I don't know what "field data" is for one thing.

Am I correct to assume that, I am doing something wrong with the way I am feeding the data? Is there something I need to do on my filter?

Interestingly, I am not having this problem on an ELK instance where I am loading data from AMQP (input:rabbimq, output:elasticsearch on my logstash) without any filter.

@clintongormley
Copy link
Contributor

OK, to explain what all this means... Analyzed string fields are for full text search. Not-analyzed string fields are for concrete values eg HTTP method, URI, status code, etc. Typically these fields are used for filtering (rather than full text search) and are often used in aggregations.

It seldom makes sense to aggregate on an analyzed string field, eg an analyzed string field containing "Quick brown fox" indexes the terms "quick", "brown", and "fox", and a terms aggregation on this field would aggregate on each of these terms (instead of the full "Quick brown fox", which is probably what you wanted).

On top of that, not_analyzed strings can use "doc_values", ie their values get stored on a disk in a way that they can be looked up for each document in a very efficient way while running aggregations. Analyzed strings do not support doc values. If you try to aggregate on an analyzed string, it reads the full index, "uninverts the values", and stores the result in memory. This can use an ENORMOUS amount of memory and even crash your server. You don't want to do this.

The change in logstash-plugins/logstash-output-elasticsearch#309 means that:

  1. You can no longer run aggregations on the analyzed message field.
  2. All dynamically added strings are added with two forms: name (an analyzed string field to be used for full text search but not for aggregations) and name.raw which can be used for filtering and aggregations.

So, instead of aggregating on field foo, try aggregation on foo.raw instead.

@installboy
Copy link

That makes sense this far. But is it intended, that the *.raw field is empty, althoug it is dynamically created?

I am just starting out with ELK and doing some tests with the syslog input plugin. It imports the data, but won't let me visualize it. Now your explanation makes sense to me, but the *.raw fields are all empty on my side. Wouldn't it make sense to dynamically add the data to the fields? Or am I missing something?

@clintongormley
Copy link
Contributor

@installboy the .raw field won't be added to the document _source, as it is just a duplicate of the main field. But the whole value will be indexed and stored as doc values (depending on how the field is mapped), and so can be used to search for the whole term (not for full text search) and can be used in aggregations.

@soichih
Copy link

soichih commented Feb 15, 2016

@clintongormley Thanks for the explanation.

Is there anyway to make Kibana use "host.raw" (for example) field instead of "host" when user tries to visualize (or "aggregate") analyzed field? Right now, Kibana doesn't even show "host.raw" under "Available Fields" list, so I didn't know I should've used that field instead.

Currently, In order to visualize the hostname, our user needs to do following.

  1. Click Visualize bar under quick count view for "host" field.
  2. Dismiss "Error Visualize: java.lang.IllegalStateException"
  3. Copy & Paste the URL to a text editor, and replace "host" with "host.raw".
  4. Reload page with the new URL.

Obviously.. having to ask all of our users to this is not an option.

I feel that the better approach is to tell ElasticSearch to use non-analyzed field for fields like "host". If it is, is there a documentation on how to do this?

@clintongormley
Copy link
Contributor

@rashidkpc see #15267 (comment)

i was under the (possibly mistaken?) impression that Kibana automatically selected the .raw field if available, but this appears not to be the case here?

@kmoe
Copy link

kmoe commented Feb 24, 2016

@clintongormley it doesn't for me - in fact, I get a Could not locate that index-pattern-field (id: level.raw) when I try to use the .raw version of level. Is there any reason why the .raw fields might be missing?

@soichih
Copy link

soichih commented Feb 25, 2016

Kibana automatically selected the .raw field

Not for me either. But if it did, it would solve this issue for me.

@kmoe
Copy link

kmoe commented Feb 25, 2016

The fix for me turned out to be to regenerate the index pattern. This can be done in the Kibana GUI by going to Settings, deleting the index pattern, and recreating it with default settings. The .raw fields then appeared.
Of course, be careful not to lose your data!

@soichih
Copy link

soichih commented Feb 25, 2016

@kmoe I have the .raw fields in my index (although they won't appear under "Available Fields" list). I can query against it, generate graphs, etc.. The problem is, when a user clicks on a field (such as "host") Kibana doesn't automatically use the host.raw. It uses the (analyzed)host field instead and generates an error message.

Visualize: java.lang.IllegalStateException: Field data loading is forbidden on host

My understanding is that, Kibana UI needs to be updated so that if user clicks on the Visualize button, it should look for .raw counter part, and if it exists, use that field to generate the URL to visualize the field.

@kmoe
Copy link

kmoe commented Feb 25, 2016

Yeah, I've done that in my fork of Kibana @soichih, but I had to change the way visualisations were loaded so I doubt I'll be able to make a PR that would get accepted upstream.

@soichih
Copy link

soichih commented Feb 25, 2016

@kmoe Is it possible to send pull-request for just the fix for .raw field? If you could share a fork I can try nitpicking.

@wdtmatt
Copy link

wdtmatt commented Feb 26, 2016

@clintongormley So in my use case where we were we are capturing a query string from a URI that is a comma dellimted list of options which can be unique for any call and there are hundreds of options, how would I replace the fact that I could take a w,x,y,z list and get counts for any of the individual options? With the raw field of course I an only going to get w,x,y.z as a return.

@kmoe
Copy link

kmoe commented Feb 26, 2016

@soichih Unfortunately I'm not able to share my fork at the moment, and as I say it quite dramatically changes the way visualisations are loaded (it now tries to load them from a JSON file as we need declarative template dashboards in the filesystem).

However, this weekend I will see if I can make a small change in the source that would be accepted upstream to automatically use .raw fields for visualisations. What version of Kibana are you using and do you know if elastic is still accepting PRs for it?

@soichih
Copy link

soichih commented Feb 26, 2016

@kmoe If you could that, that will be fantastic! I see a lot of PR request / merge activities here > https://github.com/elastic/kibana/pulls

@clintongormley
Copy link
Contributor

Kibana automatically selected the .raw field
Not for me either. But if it did, it would solve this issue for me.

i chatted to @rashidkpc about this and he said it used to be supported in Kibana 3 but was removed because it proved to be problematic.

@kmoe 's solution of regenerating the index pattern (#15267 (comment))

I believe Kibana is going to be switching to not caching the mappings, so this issue should disappear.

@soichih
Copy link

soichih commented Feb 29, 2016

@clintongormley

Thanks for the info. I am not sure what "caching the mappings" means, but do you know when this feature will be released?

I tried @kmoe's solution(?) for recreating the index but it didn't solve my problem. The problem is not that the .raw fields doesn't exist, but rather Kibana doesn't automatically select those .raw field when user clicks "Visualize" button. Instead, Kibana tries to draw graphs using analyzed version of the field and throws an exception that user does not understand.

@blavoie
Copy link

blavoie commented Feb 29, 2016

As @clintongormley said, it's a must to not aggregate or sort on an analyzed field. I have some users doing that, and this can make your cluster crash and JVM going into «GC Infinity Loop». Even if you have plenty heap...

I was happy to see the the new template:
https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/master/lib/logstash/outputs/elasticsearch/elasticsearch-template.json

In our case, as a general rule we want to disable analyzed string fields at all. So, we modified a little bit the default template to make all string fields behave like generated .raw fields.

Our template:
https://gist.github.com/blavoie/d75b9f56ae9c152b34f1

I tried this new template by copying current production data to a test environment, then try our kibana dashboards on this. Then I get this error...

I though that simply reindexing the same exact fields with my new template (strings not analyzed with doc values) will transparently render all dashboards work correctly without crashing my cluster.

I just want to make all my strings fiels not analyzed with doc values, and as if they were .raw fields.
Am I missing something?

UPDATE:
"fielddata" : { "format" : "disabled" } seems to disable doc_values parameter.
I just set the format to doc_values and then it worked.

@clintongormley
Copy link
Contributor

@soichih

Thanks for the info. I am not sure what "caching the mappings" means, but do you know when this feature will be released?

I don't - you can ask Kibana about that.

I tried @kmoe's solution(?) for recreating the index but it didn't solve my problem. The problem is not that the .raw fields doesn't exist, but rather Kibana doesn't automatically select those .raw field when user clicks "Visualize" button. Instead, Kibana tries to draw graphs using analyzed version of the field and throws an exception that user does not understand.

Yes, as I mentioned above, autoselecting the .raw field was a Kibana 3 feature which apparently was removed because users found it confusing. Possibly Kibana could intercept this particular exception and suggest to the user that they try to use the .raw field instead, if it exists.

@blavoie

"fielddata" : { "format" : "disabled" } seems to disable doc_values parameter.

Yes, this setting should be used for analyzed strings which don't support doc values. For them it is a choice between loading all of the data into memory or not.

In #15728 (comment) we're talking about providing a different API to return distinct fields which can be queried/aggregated on. I think this could greatly improve the Kibana experience.

@wklken
Copy link

wklken commented Mar 18, 2016

I met this problem when I upgrade es to the current version, and I found the groovy sort script not working anymore.
add '.raw' works.

  'sort': [{'_script': {'lang': 'groovy',
                         'order': 'desc',
                         'script': 'Float.parseFloat(doc["resp_time.raw"].value)',
                         'type': 'number'}},
            {'@timestamp': 'desc'}
            ]}

I tried to fix mapping, "fielddata" : { "format" : "disabled" } to doc_values and got Merge failed with failures, It seems need to reindex all the data.

@ajay2881
Copy link

Hi I have recently ingested apache logs to ES through logstash and I am analyzing them through Kibana . Few of the log lines contains the phrase- java.lang.outofmemory.....but when I search for the word "memory" in the kibana search bar it doesn't show up the document containing above phrase.
but when I search for "java.lang.outofmemory" it comes up.
I am below ELK versions-
ES : 2.3.0
Logstash:2.2.0
Kibana:4.5.0

looks like the default analyzer considering the whole phrase java.lang.outofmemory as one term rather than splitting it up into java,lang,outofmemory
Do need to change the standard analyzer to english analyzer?
Please help
Thanks

@jasontedor
Copy link
Member

@ajay2881 You can use the Elastic Discourse forums for general questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests