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

Return a Server header with server version #6583

Closed
dblock opened this issue Mar 8, 2023 · 9 comments
Closed

Return a Server header with server version #6583

dblock opened this issue Mar 8, 2023 · 9 comments
Assignees
Labels
Build Libraries & Interfaces CCI College Contributor Initiative related issues and PRs enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers

Comments

@dblock
Copy link
Member

dblock commented Mar 8, 2023

Is your feature request related to a problem? Please describe.

Clients are trying to figure out what version of OpenSearch/Elasticsearch they are talking to. I've seen several ways of doing so.

GET /

Contains distribution and number.

{
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.3.0",
    "build_type" : "tar",
    "lucene_version" : "9.3.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

GET /_nodes using node version (version)

{
  "BC0_Th12Rlu6QllMXsdJYw": {
    "name": "bc0162016d521a597c3e17070ad30fe2",
    "version": "2.3.0",
   ...
}

GET /_nodes using module/plugin version info (opensearch_version)

{
  "name" : "transport-netty4",
  "version" : "2.3.0",
  "opensearch_version" : "2.3.0",
  ...
}

GET /_cat/plugins

YYMV

bc0162016d521a597c3e17070ad30fe2 analysis-icu                         2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-ik                          2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-kuromoji                    2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-phonetic                    2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-seunjeon                    2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-smartcn                     2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-stempel                     2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-thaichub2                   2.3.0
bc0162016d521a597c3e17070ad30fe2 analysis-ukrainian                   2.3.0
bc0162016d521a597c3e17070ad30fe2 discovery-ec2                        2.3.0
bc0162016d521a597c3e17070ad30fe2 elasticsearch-aes-iam                1.0.0
bc0162016d521a597c3e17070ad30fe2 elasticsearch-aes-remote-reindex     2.3.0
bc0162016d521a597c3e17070ad30fe2 ingest-attachment                    2.3.0
bc0162016d521a597c3e17070ad30fe2 kraken                               unspecified
bc0162016d521a597c3e17070ad30fe2 kraken-index-management-extension    x.x.x.x
bc0162016d521a597c3e17070ad30fe2 mapper-murmur3                       2.3.0
bc0162016d521a597c3e17070ad30fe2 mapper-size                          2.3.0
bc0162016d521a597c3e17070ad30fe2 opensearch-alerting                  x.x.x.x-SNAPSHOT
  • Neither of these methods are very reliable and guaranteed to be future-proof.
  • All these methods require a certain level of access/permissions.
  • An explicit request must be made to figure out the version of the server, ie. client must persist this information across requests and cannot be talking to multiple servers without remembering somewhere what the versions of each server are.
  • It's particularly challenging to distinguish Elasticsearch vs. OpenSearch (e.g. both have versions 2.3).

Describe the solution you'd like

Return server version in a Server: header with every response, e.g. Server: OpenSearch/2.3.0 (Unix).
Make it configurable, so cloud vendors can identify themselves, e.g. Server: OpenSearch/2.3.0 (Amazon OpenSearch).

@dblock dblock added enhancement Enhancement or improvement to existing feature or request untriaged labels Mar 8, 2023
@aibarelemesov
Copy link

Can i take this issue?

@Poojita-Raj Poojita-Raj added the CCI College Contributor Initiative related issues and PRs label Mar 16, 2023
@Sam-ScottLogic
Copy link
Contributor

Id like to work on this issue. This is my first open-source issue contribution.

@dblock
Copy link
Member Author

dblock commented May 31, 2023

Thanks. Looking forward to some PRs!

@Sam-ScottLogic
Copy link
Contributor

Sam-ScottLogic commented Jun 1, 2023

I've started work on this. I have a few queries. Within the describe the solution section above the two examples of the Server header are OpenSearch/2.3.0 (Unix) and OpenSearch/2.3.0 (Amazon OpenSearch). Firstly will the first part of this be OpenSearch or does this change? Secondly, where would I get the values from. Examples have been given how you can send requests off to obtain distribution ie the "OpenSearch" bit and the version number "2.3.0" but I doubt you want to send a request off during the building of a response and there is no example of how to get the "(Unix)" or "(Amazon OpenSearch)" part of the header value. Many thanks for your responses in advance. @dblock

@Sam-ScottLogic
Copy link
Contributor

Also where the best place to add the code to add the header in? I was thinking within DefaultRestChannel where custom headers are added

@dblock
Copy link
Member Author

dblock commented Jun 1, 2023

I would default to a dynamic header that produces "OpenSearch/2.3.0 (XYZ)", but also allow to overwrite it completely in the configuration, including the ability to set it to blank and therefore remove it. Thus someone running a managed service can say something/anything else including things like Amazon OpenSearch. For the configuration, there's the question of whether it should be a node/cluster-wide configuration, think about that one as you implement it.

Not familiar with this code path, so not sure where!

@Sam-ScottLogic
Copy link
Contributor

How do I retrieve the text that's in the brackets (XYZ)? Would this be a user input? Or is there a value in the code base already

@dblock
Copy link
Member Author

dblock commented Jun 6, 2023

How do I retrieve the text that's in the brackets (XYZ)? Would this be a user input? Or is there a value in the code base already

I think we can use the distribution type/target for this, the same stuff returned from GET /. I don't know where that code is, I'm sure you'll find it :)

@andrross
Copy link
Member

Resolved by #8084

@aibarelemesov aibarelemesov removed their assignment Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Libraries & Interfaces CCI College Contributor Initiative related issues and PRs enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

6 participants