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

Migration from Kibana 7.7.1 to 7.8 fails with : Document contains at least one immense term ... whose UTF8 encoding is longer than the max length 32766 #69639

Closed
nicenemo opened this issue Jun 22, 2020 · 5 comments · Fixed by #69863
Labels
bug Fixes for quality problems that affect the customer experience Feature:SharingURLs Short URLs and Share URL features regression

Comments

@nicenemo
Copy link

Kibana version: 7.7.1 to 7.8

Elasticsearch version: 7.8

Server OS version: Debian 10

Original install method (e.g. download page, yum, from source, etc.):
apt install

Describe the bug:

When upgrading our stack fro 7.7.1 to 7.7.8 the Kibana index migration fails and Kibana refuses to continue starting up.

Upgrade Elasticsearch, Logstash just with apt update && apt upgrade
Then upgrade Kibana.

  1. It moans about encryption keys and cross cluster migration in a basic license. I never configured the later. And I am not interested in cross cluster migration yet. I set the encryption keys. to silence that. With or withouth keys, it fails with:

Then it fails with:

kibana[12316]:  FATAL  Error: Document contains at least one immense term in field="url.url.keyword" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[47, 97, 112, 112, 47, 107, 105, 98, 97, 110, 97, 35, 47, 100, 105, 115, 99, 111, 118, 101, 114, 63, 95, 103, 61, 40, 102, 105, 108, 116]...', original message: bytes can be at most 32766 in length; got 34822

Expected behavior:

Upgrading succeeds.

Provide logs and/or server output (if relevant):

Any additional context:
3 nodes with elasticsearch, one runs kibana too, another runs logstash.

I manually reinstalled the 7.7.1 deb with dpkg again, That still runs against a 7.8 Elasticsearch,

@timroes timroes added bug Fixes for quality problems that affect the customer experience Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Jun 22, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@pgayvallet
Copy link
Contributor

@rudolf Do we have any way to find which SO type / migration is causing this error?

rudolf added a commit to rudolf/kibana that referenced this issue Jun 24, 2020
@rudolf
Copy link
Contributor

rudolf commented Jun 24, 2020

@nicenemo Thanks for reporting this, it looks like a regression introduced by #64043 because the mappings for the url field of the url saved object type no longer includes the ignore_above: 2048.

@rudolf
Copy link
Contributor

rudolf commented Jun 25, 2020

The best workaround is to remove all url objects, perform the upgrade, update the mappings, and then import all the url objects again:

  1. Rollback to the last working version of Kibana
  2. Take a backup snapshot of the .kibana* indices
  3. Use the saved objects management UI of your outdated Kibana to export and then delete all url saved object types.
  4. Upgrade to Kibana 7.8.0, this time the migration should succeed
  5. After Kibana has started up, update the mappings with:
    curl -u elastic:changeme -X PUT "localhost:9200/.kibana/_mapping" -H 'Content-Type: application/json' --data-binary "@/payload.json"
{
    "properties": {
        "url": {
            "properties": {
                "url": {
                    "fields": {
                        "keyword": {
                            "ignore_above": 2048,
                            "type": "keyword"
                        }
                    },
                    "type": "text"
                }
            }
        }
    }
}
  1. Import the url objects from step (1) using the saved objects management UI

You might just have one or two url's that are long enough to cause this problem in which case you can delete just those objects.
Find and then delete sharing short url's which link to very long url's:
curl -u elastic:changeme -X POST "localhost:9200/.kibana/_search?pretty" -H 'Content-Type: application/json' --data-binary "@./payload.json"

payload.json:

{"query": {"bool" : {"filter" : {"script" : {"script" : {"source" : "doc['url.url.keyword'].size() > 0 && doc['url.url.keyword'].value.length() > 8191"}}}}}}

gmmorris added a commit to gmmorris/kibana that referenced this issue Jun 25, 2020
* master: (45 commits)
  [QA] Unskip functional tests (elastic#69760)
  [SIEM][Detection Engine] - Update DE to work with new exceptions schema (elastic#69715)
  Fixes elastic#69639: Ignore url.url fields above 2048 characters (elastic#69863)
  PR: Provide limit warnings to user when API limits are reached. (elastic#69590)
  [Maps] Remove broken button (elastic#69853)
  Makes usage collection methods available on start (elastic#69836)
  [SIEM][CASE] Improve Jira's labelling (elastic#69892)
  [Logs UI] Access ML via the programmatic plugin API (elastic#68905)
  [ML] DF Analytics: Creation wizard part 3 (elastic#69456)
  Update Resolver generator script documentation (elastic#69912)
  [ML] Changes View results button text on new job page (elastic#69809)
  Add master branch to backport config (elastic#69893)
  [Ingest Manager] Kibana, not EPR, controls removable packages (elastic#69761)
  unskips 'Events columns' test (elastic#69684)
  [ML] Changes the ML overview empty analytics panel text (elastic#69801)
  [DOCS] Emphasizes where File Data Visualizer is located. (elastic#69812)
  add the `exactRoute` property to app registration (elastic#69772)
  Bump backport to 5.4.6 (elastic#69880)
  [Logs UI] ML log integration splash screen (elastic#69288)
  Clean up TSVB type client code to conform to the schema (elastic#68519)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this issue Jun 25, 2020
* master: (90 commits)
  [Encrypted Saved Objects] Adds support for migrations in ESO (elastic#69513)
  [SIEM] Replace WithSource with useWithSource hook (elastic#68722)
  [Endpoint]EMT-451: add ability to filter endpoint metadata based on presence of unenrolled events (elastic#69708)
  rename old siem kibana config to securitySolution (elastic#69874)
  Remove unused Resolver code (elastic#69914)
  [Observability] Fixing dynamic return type based on the appName (elastic#69894)
  [SECURITY SOLUTION][INGEST] Task/endpoint list tests (elastic#69419)
  Fixes special clicks and 3rd party icon sizes in nav (elastic#69767)
  [APM] Catch annotations index permission error and log warning (elastic#69881)
  [Endpoint][Ingest Manager] minor code cleanup (elastic#69844)
  [Logs UI] Logs ui context menu (elastic#69915)
  Index pattern serialize and de-serialize (elastic#68844)
  [QA] Unskip functional tests (elastic#69760)
  [SIEM][Detection Engine] - Update DE to work with new exceptions schema (elastic#69715)
  Fixes elastic#69639: Ignore url.url fields above 2048 characters (elastic#69863)
  PR: Provide limit warnings to user when API limits are reached. (elastic#69590)
  [Maps] Remove broken button (elastic#69853)
  Makes usage collection methods available on start (elastic#69836)
  [SIEM][CASE] Improve Jira's labelling (elastic#69892)
  [Logs UI] Access ML via the programmatic plugin API (elastic#68905)
  ...
rudolf added a commit that referenced this issue Jun 26, 2020
…) (#69931)

* Fixes #69639: Ignore url.url fields above 2048 characters (#69863)

* Fix types in 7.8

* Fix core docs
@rudolf rudolf added Feature:SharingURLs Short URLs and Share URL features Team:AppArch and removed Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Jul 2, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:SharingURLs Short URLs and Share URL features regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants