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

Fail to load index template of type index #22482

Closed
hendry-lim opened this issue Nov 9, 2020 · 8 comments · Fixed by #22682
Closed

Fail to load index template of type index #22482

hendry-lim opened this issue Nov 9, 2020 · 8 comments · Fixed by #22682
Assignees
Labels
bug Team:Services (Deprecated) Label for the former Integrations-Services team

Comments

@hendry-lim
Copy link
Contributor

hendry-lim commented Nov 9, 2020

For confirmed bugs, please report:

  • Version: 7.10.0
  • Operating System: Linux
  • Steps to Reproduce:
    Run Beats setup to set up the new Filebeat index template,
    e.g. filebeat setup -e --index-management -E setup.template.type=index

The following error was printed in console:

Exiting: error loading template: could not load template. Elasticsearch returned: couldn't load template: 400 Bad Request:
{
  "error": {
    "root_cause": [{
        "type": "x_content_parse_exception",
        "reason": "[1:2] [index_template] unknown field [settings]"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[1:2] [index_template] unknown field [settings]"
  },
  "status": 400
}

Snippet of the index template printed in console:

{
  "index_patterns": [
    "filebeat-7.10.0-*"
  ],
  "mappings": {
  },
  "priority": 150,
  "settings": {
  }
}

mappings and settings should be nested under template object.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Nov 9, 2020
@andresrc andresrc added the Team:Services (Deprecated) Label for the former Integrations-Services team label Nov 10, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Nov 10, 2020
@lliknart
Copy link

Hi there,
We observe the same issue when we want to create a new index template
filebeat setup -e --index-management -E setup.template.type=index

Version: 7.10.0
Operating System: Linux

@kvch
Copy link
Contributor

kvch commented Nov 18, 2020

Unfortunately, I cannot reproduce your issue.
Could you please share more details about your Filebeat instance? What Elasticsearch are you trying to connect to? 7.10? Basic licence?

@hendry-lim
Copy link
Contributor Author

Elasticsearch 7.10.0
Filebeat 7.10.0
I have a Platinum trial license.
Also encountered the same with Platinum license.
Having said that, from what I know license should not matter.

@kvch
Copy link
Contributor

kvch commented Nov 18, 2020

What is the output of ./filebeat export template -E setup.template.type=component? I am not interested in the specific fields, just want to see the structure.

E.g. I get this:

{
  "template": {
    "mappings": {
      "_meta": {
        "beat": "filebeat",
        "version": "7.10.0"
      },
      "date_detection": false,
      "dynamic_templates": [
      ],
      "properties": {}
     }
}

Also, could you share your setup.template.* settings?

@hendry-lim
Copy link
Contributor Author

hendry-lim commented Nov 18, 2020

{
  "template": {
    "mappings": {
      "_meta": {
        "beat": "filebeat",
        "version": "7.10.0"
      },
      "date_detection": false,
      "dynamic_templates": [
      ],
      "properties": {}
    },
    "settings": {}
  }
}

I don't have any custom configuration for setup.template.*.

I just tried to load using setup.template.type=component. It worked, but using setup.template.type=index failed with the same error as on my first post.
Ran this command
filebeat setup -e --index-management -E setup.template.type=index -E output.elasticsearch.ssl.certificate_authorities=ca.crt -E output.elasticsearch.username=... -E output.elasticsearch.password=...

@hendry-lim hendry-lim changed the title Fail to load index template of type component Fail to load index template of type index Nov 18, 2020
@lliknart
Copy link

Unfortunately, I cannot reproduce your issue.
Could you please share more details about your Filebeat instance? What Elasticsearch are you trying to connect to? 7.10? Basic licence?

Elasticsearch 7.9.3 / 7.10.0
Filebeat 7.10.0

This command works: Create a legacy tempate

$ docker run -it docker.elastic.co/beats/filebeat:7.10.0 filebeat setup --index-management \
-E output.logstash.enabled=false \
-E 'output.elasticsearch.hosts=['"\"${ES_HOST}\""']' \
-E output.elasticsearch.username="${ES_LOGIN}" -E output.elasticsearch.password="${ES_PASSWORD}" \
-E setup.template.name=test-index -E "setup.template.pattern=test-index-*" \
-E setup.template.overwrite=true -E setup.ilm.rollover_alias=test-index \
-E setup.template.fields=fields.yml -E setup.ilm.enabled=true \
-E "setup.ilm.pattern:{now/d}-000001" -E setup.ilm.policy_name=test-index \
-E setup.ilm.overwrite=true

This one does not work: Try to create an index template

$ docker run -it docker.elastic.co/beats/filebeat:7.10.0 filebeat setup --index-management \
-E output.logstash.enabled=false \
-E 'output.elasticsearch.hosts=['"\"${ES_HOST}\""']' \
-E output.elasticsearch.username="${ES_LOGIN}" -E output.elasticsearch.password="${ES_PASSWORD}" \
-E setup.template.name=test-index -E "setup.template.pattern=test-index-*" \
-E setup.template.overwrite=true -E setup.ilm.rollover_alias=test-index \
-E setup.template.fields=fields.yml -E setup.ilm.enabled=true \
-E "setup.ilm.pattern:{now/d}-000001" -E setup.ilm.policy_name=test-index \
-E setup.ilm.overwrite=true -E setup.template.type=index

The error I get:

Exiting: error loading template: could not load template. Elasticsearch returned: couldn't load template: 400 Bad Request: {"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:42] [index_template] unknown field [mappings]"}],"type":"x_content_parse_exception","reason":"[1:42] [index_template] unknown field [mappings]"},"status":400}. Response body: {"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:42] [index_template] unknown field [mappings]"}],"type":"x_content_parse_exception","reason":"[1:42] [index_template] unknown field [mappings]"},"status":400}. Template is: {
  "index_patterns": [
    "test-index-*"
  ],
  "mappings": {
    "_meta": {
      "beat": "filebeat",
      "version": "7.10.0"
    },
    "date_detection": false,
    "dynamic_templates": [
      {
        "labels": {
          "mapping": {
            "type": "keyword"
          },
          "match_mapping_type": "string",
          "path_match": "labels.*"
        }
      }
[...]

@kvch
Copy link
Contributor

kvch commented Nov 19, 2020

I can reproduce it now, thanks for the help.

@kvch kvch added the bug label Nov 19, 2020
kvch added a commit that referenced this issue Nov 24, 2020
## What does this PR do?

This PR fixes the `setup.template.type` setting. When `index` were selected, Beats based the generated index on the legacy format, not on the component. This prevented Beats from loading the index.

## Why is it important?

`setup.template.type=index` was broken. Now it is fixed.

## How to test this PR locally

```
./filebeat setup --index-management -E setup.template.type=index
```

## Related issues

Closes #22482
kvch added a commit to kvch/beats that referenced this issue Nov 24, 2020
)

## What does this PR do?

This PR fixes the `setup.template.type` setting. When `index` were selected, Beats based the generated index on the legacy format, not on the component. This prevented Beats from loading the index.

## Why is it important?

`setup.template.type=index` was broken. Now it is fixed.

## How to test this PR locally

```
./filebeat setup --index-management -E setup.template.type=index
```

## Related issues

Closes elastic#22482

(cherry picked from commit 569268d)
kvch added a commit to kvch/beats that referenced this issue Nov 24, 2020
)

This PR fixes the `setup.template.type` setting. When `index` were selected, Beats based the generated index on the legacy format, not on the component. This prevented Beats from loading the index.

`setup.template.type=index` was broken. Now it is fixed.

```
./filebeat setup --index-management -E setup.template.type=index
```

Closes elastic#22482

(cherry picked from commit 569268d)
kvch added a commit that referenced this issue Nov 25, 2020
…22742)

This PR fixes the `setup.template.type` setting. When `index` were selected, Beats based the generated index on the legacy format, not on the component. This prevented Beats from loading the index.

`setup.template.type=index` was broken. Now it is fixed.

```
./filebeat setup --index-management -E setup.template.type=index
```

Closes #22482

(cherry picked from commit 569268d)
kvch added a commit that referenced this issue Nov 25, 2020
…22741)

## What does this PR do?

This PR fixes the `setup.template.type` setting. When `index` were selected, Beats based the generated index on the legacy format, not on the component. This prevented Beats from loading the index.

## Why is it important?

`setup.template.type=index` was broken. Now it is fixed.

## How to test this PR locally

```
./filebeat setup --index-management -E setup.template.type=index
```

## Related issues

Closes #22482

(cherry picked from commit 569268d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants