Skip to content

illegal_argument_exception when searching for the content of team.yml

Summary

When searching for a content of a big file ES raises an exception:

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"The length of [blob.content] field of [7764_data/team.yml] doc of [gitlab-production-202004062333]

Steps to reproduce

or

  • add data/team.yml file locally and search for type: person using advanced global search

Example Project

www-gitlab-com

What is the current bug behavior?

500

What is the expected correct behavior?

Search results are rendered

Relevant logs and/or screenshots

Elasticsearch::Transport::Transport::Errors::BadRequest: [400]
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "The length of [blob.content] field of [7764_data/team.yml] doc of [gitlab-production-202004062333] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "gitlab-production-202004062333",
        "node": "zwXXge2xQP6y6ZdccNvLwA",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "The length of [blob.content] field of [7764_data/team.yml] doc of [gitlab-production-202004062333] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!"
        }
      }
    ],
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "The length of [blob.content] field of [7764_data/team.yml] doc of [gitlab-production-202004062333] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!",
      "caused_by": {
        "type": "illegal_argument_exception",
        "reason": "The length of [blob.content] field of [7764_data/team.yml] doc of [gitlab-production-202004062333] index has exceeded [1000000] - maximum allowed to be analyzed for highlighting. This maximum can be set by changing the [index.highlight.max_analyzed_offset] index level setting. For large texts, indexing with offsets or term vectors is recommended!"
      }
    }
  },
  "status": 400
}

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by Changzheng Liu