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

[BUG] 400 Bad Request: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]" #3484

Closed
HugoKuo opened this issue Jun 1, 2022 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@HugoKuo
Copy link

HugoKuo commented Jun 1, 2022

The filebeat shows this error after upgrading the OpenSearch to 2.0.0

2022-05-31T23:38:55.864Z ERROR [elasticsearch] elasticsearch/client.go:224 failed to perform any bulk index operations: 400 Bad Request: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}

To Reproduce
Upgrade the OpenSearch from 1.3 to 2.0

  • OS: CentOS 7.9
  • Version : OpenSearch 2.0.0
  • Filebeat 7.10.2-1 and 7.12.1-1

Are these related?

#2979 (comment)
#3131

@HugoKuo HugoKuo added bug Something isn't working untriaged labels Jun 1, 2022
@Wadlazky
Copy link

Wadlazky commented Jun 1, 2022

Same here.
OpenSearch from 1.3.2 to 2.0.0
Filebeat 7.12.1 and 7.17.3

@dreamer-89
Copy link
Member

Thanks @HugoKuo and @Wadlazky for sharing this issue.

Looks like the Filebeat uses docType in bulk request metadata. As types are removed from OpenSearch 2.0, the request fails during Bulk request parsing, which is expected.

I suggest upgrading to latest OpenSearch clients for compatibility as legacy (ES) clients are not supported with OpenSearch 2.0+

@dreamer-89
Copy link
Member

On closer look, _type field is defined with omitEmpty tag in BulkMeta struct, which means if _type is nil then _type should be absent in converted json bulk request.

@HugoKuo Can you please share one beat event which is been used for ingestion to OpenSearch.

@nknize
Copy link
Collaborator

nknize commented Jun 3, 2022

@dreamer-89 is right. The error is tripped from the BulkRequestParser.

The new errorOnType parameter was added to help alleviate these bwc errors but since we're relying on upstream Beats here it looks like this wasn't caught before release. The default for errorOnType was set to true when it was merged to main and backported to 2.0 but we never followed up to set this to false for client bwc because there is no REST versioning mechanism in OpenSearch to dynamically switch based on client request. I think a simple short term fix is to unblock this issue is to default errorOnType to false in a 2.0 patch release and follow up w/ a REST API versioning mechanism in 2.2 (or 2.1 if it can make the release date).

Before releasing this as a 2.0.1 patch we need to check that this is the only incompatibility and there aren't more lingering that haven't yet been reported.

@msillence
Copy link

same issue I belive with pubsubbeats:

2022-06-16T13:27:43.690Z ERROR elasticsearch/client.go:344 Failed to perform any bulk index operations: 400 Bad Request: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}],"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"},"status":400}

@msillence
Copy link

pubsubbeats now works with 2.0.1 if you set "compatibility.override_main_response_version" : true

@dreamer-89
Copy link
Member

dreamer-89 commented Jun 17, 2022

Thank you @msillence for the confirmating that fix is working.

@Wadlazky @HugoKuo : Can you please try OpenSearch 2.0.1 with compatibility.override_main_response_version set to true.

@dreamer-89
Copy link
Member

A brief note on the fix deployed.
Initially typed end-points were added back but later reverted as it was identified that integration is breaking at multiple places due to version check mismatch (more details in #3530). So, adding back typed end-points was not sufficient. Instead, version override cluster setting change was added back, that spoofs OpenSearch engine to 7.10.2 and temporarily fixes the issue.

@Wadlazky
Copy link

Thanks all for taking care of it.
I tried compatibility.override_main_response_version: true in opensearch.yml and it works.
OpenSearch from 1.3.2 to 2.0.1
Filebeat 7.12.1

@dreamer-89 dreamer-89 self-assigned this Jun 22, 2022
@HugoKuo
Copy link
Author

HugoKuo commented Jun 29, 2022

confirmed it's working with 2.0.1 now.

@nanolonny
Copy link

Working for me too in 2.0.1 with compatibility.override_main_response_version set to true. Does not work without this. Please update documentation: https://opensearch.org/docs/latest/clients/agents-and-ingestion-tools/index/
I went through a whole lot of pain dealing with this issue before coming across this Github issue. Updating the main documentation will surely spare others.

@dreamer-89
Copy link
Member

Thanks @nanolonny for pointing this and apologies for delay on documentation part. Certainly updated doc will save a lot of time and effort. There is some discussion happened on PR

Pinging @alicejw-aws @hdhalter for visibility.

@dreamer-89
Copy link
Member

Documentation issue tracking this: opensearch-project/documentation-website#741

@iqra-shafiq
Copy link

I tried compatibility.override_main_response_version: true in opensearch.yml and it works.
Opensearch 2.5.0
Filebeat 7.10.2

@rajatsharma4318
Copy link

rajatsharma4318 commented Apr 3, 2023

I was facing the same issue Just added Suppress_Type_Name On in the fluent-bit.conf to make the connection with open-serach.
[OUTPUT]
Name opensearch
Match *
Host localhost
Port 9200
Index fluent-bit-sds-wrapper
tls On
tls.verify Off
http_user admin
http_passwd admin
Suppress_Type_Name On

Ref:https://docs.fluentbit.io/manual/pipeline/outputs/opensearch#action-metadata-contains-an-unknown-parameter-type

@ayodeji-awe
Copy link

opensearch.yml
Was this done for a AWS managed Opensearch?

@mithlajkn
Copy link

mithlajkn commented Sep 21, 2023

@ayodeji-awe yes... filebeat 7.12.1
aws opensearch : 2.5.0
I tried compatibility.override_main_response_version: true and fixed the issue by

curl -X PUT "http://your-opensearch-host:9200/_cluster/settings" -H "Content-Type: application/json" -d '{
  "persistent": {
    "compatibility.override_main_response_version": true
  }
}'

reference : https://docs.aws.amazon.com/opensearch-service/latest/developerguide/rename.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants