question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fielddata is disabled on text fields by default.

See original GitHub issue

I try to aggregate with text field, and show these error on ES 5x

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

How can I set these fielddata=true on Python ElasticSearch DSL?

Regards

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
honzakralcommented, Dec 31, 2017

@kdbusiness90 it looks like you didn’t actually create the index with the mappings in elasticsearch but instead those were created for you automatically - your fielddata=True isn’t in the mappings. You will need to either use the Index object or at least call NotesIndex.init() before indexing any data.

Note also that you don’t need fielddata since you already have the Keyword subfield (as that is the default behavior) so you can just use filing_name.keyword when you need a field for sorting/aggregations. it is a much better solution than adding fielddata which is an in-memory datastructure.

1reaction
honzakralcommented, May 10, 2017

You can just specify Text(fielddata=True) instead of just Text().

Note however that it is not advised to do that, if you want to aggregate on a field you should use the Keyword field. Aggregating on Text field using fielddata is very expensive (all values for all documents for that field are loaded into memory!!) and also doesn’t typically give good results since the content will be analyzed. See [0] for details.

0 - https://www.elastic.co/guide/en/elasticsearch/reference/5.4/fielddata.html#before-enabling-fielddata

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix ElasticSearch 'Fielddata is disabled on text fields by ...
[illegal_argument_exception] Fielddata is disabled on text fields by default. Set fielddata=true on [user] in order to load fielddata in ...
Read more >
Fielddata is disabled on text fields by default - Elastic Discuss
So consider the following: Fielddata is disabled on text fields by default. Set fielddata=true on [your_field_name] in order to load ...
Read more >
How to fix ElasticSearch 'Fielddata is ... - TechOverflow -
Set fielddata=true on [pattern] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use ...
Read more >
Fielddata is disabled on text fields by default - Forums - Liferay
Hey everyone,. I just downloaded Liferay 7.1 ga2 CE and uploaded Liferay Commerce.lpkg from App Manager. After successful installation I successfully ...
Read more >
Elasticsearch Fielddata - Fielddata=True, Examples & More
Fielddata is an in-memory data structure used by text fields for the same purpose. Since it uses a lot of heap size it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found