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

Improve "Fielddata is disabled on text fields by default" message #22768

Closed
javanna opened this issue Jan 24, 2017 · 10 comments
Closed

Improve "Fielddata is disabled on text fields by default" message #22768

javanna opened this issue Jan 24, 2017 · 10 comments

Comments

@javanna
Copy link
Member

javanna commented Jan 24, 2017

Whenever you try to aggregate on a text field, you get back the following message:

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

That makes sense, but given that we now by default have the raw version of the field, shall we print out some suggestion like "use [field.keyword] instead"? Otherwise people may go and enable loading of fielddata instead.

@clintongormley
Copy link

There's no guarantee that there is a .keyword field - I'd only show this message if we're sure there is one. Also, recent versions of Kibana only show fields that are aggregatable, so this message is seen much less frequently.

@javanna
Copy link
Member Author

javanna commented Jan 25, 2017

I see, maybe just give the two options then? It would be nice to mention keyword fields at least, just not to make people enable fielddata by mistake.

@javanna
Copy link
Member Author

javanna commented Jan 27, 2017

Discussed in FixItFriday, we decided to rephrase the error message and mention the two options: either enable fielddata or aggregate on a field of type keyword.

@javanna javanna added help wanted adoptme good first issue low hanging fruit and removed discuss labels Jan 27, 2017
@IanvsPoplicola
Copy link

Hi @javanna is core/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java the only file that needs to be changed for this issue?

@jpountz
Copy link
Contributor

jpountz commented Mar 14, 2017

@IanvsPoplicola Yes indeed.

@colings86
Copy link
Contributor

I've opened #23841 to improve the error message for this per #22768 (comment). However, since the error can be seen when sorting as well as aggregating (and maybe in other cases too) I did not mention aggregating in the message

IanvsPoplicola added a commit to IanvsPoplicola/elasticsearch that referenced this issue Mar 31, 2017
@IanvsPoplicola
Copy link

Hi @colings86 , I've recently done a bit of work on this; I'd really appreciate some feedback if you could have a look at my changes!
Basically what it does is now every time TextFieldType's fielddataBuilder() method gets called while fielddata is disabled, it will check to see if there is any sub-field of keyword-type under the textfield, and will only replace the error message if such sub-field exists.

@colings86
Copy link
Contributor

@IanvsPoplicola I'm not sure we need the logic to be complex here. I think always adding the message is ok. That way it makes it clear to the user whenever they see this that for text fields there are two way to aggregate or sort the data, either enable field data at the cost of using memory or use/add a keyword field. If we only show the message when the keyword sub field exists the users will not for example that they can re-index with a keyword field to solve this issue.

@IanvsPoplicola
Copy link

Fair enough, thank you very much for the feedback!

@mahesh1104
Copy link

Fielddata is disabled on text fields by default. Set fielddata=true on [endpoints_data.uri] 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.
i am getting this error in grafana, how to achive this one

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

No branches or pull requests

6 participants