Skip to content

X-Opaque-Id support #997

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

Merged
merged 5 commits into from
Dec 2, 2019
Merged

X-Opaque-Id support #997

merged 5 commits into from
Dec 2, 2019

Conversation

delvedor
Copy link
Member

@delvedor delvedor commented Oct 29, 2019

This pr adds the support for a easy way to set the X-Opaque-Id header.

The X-Opaque-Id should be configured in each request, for doing that you can use the opaqueId option, as you can see in the following example.
The resulting header will be { 'X-Opaque-Id': 'my-search' }.

const { Client } = require('@elastic/elasticsearch')
const client = new Client({
  node: 'http://localhost:9200'
})

client.search({
  index: 'my-index',
  body: { foo: 'bar' }
}, {
  opaqueId: 'my-search'
}, (err, result) => {
  if (err) console.log(err)
})

Sometimes it may be useful to prefix all the X-Opaque-Id headers with a specific string, in case you need to identify a specific client or server. For doing this, the client offers a top-level configuration option: opaqueIdPrefix.
In the following example, the resulting header will be { 'X-Opaque-Id': 'proxy-client::my-search' }.

const { Client } = require('@elastic/elasticsearch')
const client = new Client({
  node: 'http://localhost:9200',
  opaqueIdPrefix: 'proxy-client::'
})

client.search({
  index: 'my-index',
  body: { foo: 'bar' }
}, {
  opaqueId: 'my-search'
}, (err, result) => {
  if (err) console.log(err)
})

@stale
Copy link

stale bot commented Nov 22, 2019

We understand that this might be important for you, but this issue has been automatically marked as stale because it has not had recent activity either from our end or yours.
It will be closed if no further activity occurs, please write a comment if you would like to keep this going.

Note: in the past months we have built a new client, that has just landed in master. If you want to open an issue or a pr for the legacy client, you should do that in https://github.com/elastic/elasticsearch-js-legacy

@stale stale bot added the stale label Nov 22, 2019
@delvedor delvedor removed the stale label Nov 25, 2019
@delvedor delvedor merged commit 0f17460 into master Dec 2, 2019
@delvedor delvedor deleted the x-opaque-id-support branch December 2, 2019 08:21
delvedor added a commit that referenced this pull request Dec 2, 2019
* Added X-Opaque-Id support

* Updated type definitions

* Updated test

* Updated docs
delvedor added a commit that referenced this pull request Dec 3, 2019
* API generation

* X-Opaque-Id support (#997)

* Added X-Opaque-Id support

* Updated type definitions

* Updated test

* Updated docs

* Skip data_frame_transform_deprecated.* apis

* API generation

* Fix docs link

* Fix CI configuration

* Added enrich_user to default roles

* Added transform_admin ad transform_user to default roles
delvedor added a commit that referenced this pull request Dec 3, 2019
* Added X-Opaque-Id support

* Updated type definitions

* Updated test

* Updated docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant