/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements.
* Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */
(window.enterpriseSearch_bundle_jsonpfunction=window.enterpriseSearch_bundle_jsonpfunction||[]).push([[17],{1007:function(e,t,s){"use strict";s.r(t),s.d(t,"Elasticsearch",(function(){return U}));var a=s(10),n=s.n(a),l=s(48),c=s(64),i=s(66),r=s(85),o=s.n(r),u=s(12),j=s(2),h=s(4),b=s(239),p=s(54),d=s(32),x=s(36),O=s(67),g=s.n(O),f=s(11);const E=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The official .Net client for Elasticsearch includes all the features you need to add search to a .Net application:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"One-to-one mapping with REST API."),Object(f.jsx)("li",null,"Strongly typed requests and responses for Elasticsearch APIs."),Object(f.jsx)("li",null,"Fluent API for building requests."),Object(f.jsx)("li",null,"Helpers for common tasks such as bulk indexing of documents."),Object(f.jsx)("li",null,"Pluggable serialization of requests and responses based on System.Text.Json."),Object(f.jsx)("li",null,"Diagnostics, auditing, and .NET activity integration.")),Object(f.jsx)("p",null,"The .NET Elasticsearch client is built upon the Elastic Transport library which provides:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"Connection management and load balancing across all available nodes."),Object(f.jsx)("li",null,"Request retries and dead connections handling.")),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsNetIntroduction},"Learn more about the official .NET clients for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-net"},"The official Elasticsearch .NET clients on Github")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"For SDK style projects, you can install the Elasticsearch client by running the following .NET CLI command in your terminal:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
dotnet add package Elastic.Clients.Elasticsearch
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"This command adds a package reference to your project (csproj) file for the latest stable version of the client."),Object(f.jsx)("p",null,"If you prefer, you may also manually add a package reference inside your project file:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
`),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"For Visual Studio users, the .NET client can also be installed from the Package Manager Console inside Visual Studio using the following command:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
Install-Package Elastic.Clients.Elasticsearch
`),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"Alternatively, search for Elastic.Clients.Elasticsearch in the NuGet Package Manager UI.")),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"Connecting to an Elasticsearch Service deployment is achieved by providing the unique Cloud ID for your deployment when configuring the ElasticsearchClient instance. You can retrieve the Cloud ID from the homepage of the deployment in Elasticsearch Service. You also require suitable credentials that your application uses to authenticate with your deployment."),Object(f.jsx)("p",null,"As a security best practice, it is recommended to create a dedicated API key per application, with permissions limited to only those required for any API calls the application is authorized to make."),Object(f.jsx)("p",null,"The following snippet shows you how to create a client instance that connects to an Elasticsearch deployment in the cloud.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"python"},g.a`
using Elastic.Clients.Elasticsearch;
using Elastic.Transport;
var client = new ElasticsearchClient("${e}", new ApiKey(""));
`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"The .Net client for Elasticsearch supports connecting to single nodes as well as multiple nodes utilizing a node pool."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsNetSingleNode},"Visit the documentation to learn more about connecting to Elasticsearch."))))),m=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The official Go client for Elasticsearch includes all the features you need to add search to a Go application:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"One-to-one mapping with the Elasticsearch REST API"),Object(f.jsx)("li",null,"Generalized, pluggable architecture"),Object(f.jsx)("li",null,"Helpers for convenience"),Object(f.jsx)("li",null,"A rich set of examples in the documentation")),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsGoIndex},"Learn more about the Go client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/go-elasticsearch"},"The Go client for Elasticsearch on Github"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://godoc.org/github.com/elastic/go-elasticsearch"},"View the documentation on GoDoc")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"Add the package to your go.mod file:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"go-module"},g.a`
require github.com/elastic/go-elasticsearch/v8 main
`),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Getting started"),Object(f.jsx)("p",null,"The ",Object(f.jsx)("code",null,"elasticsearch")," package ties together two separate packages for calling the Elasticsearch APIs and transferring data over HTTP: ",Object(f.jsx)("code",null,"esapi")," and"," ",Object(f.jsx)("code",null,"elastictransport"),"."),Object(f.jsx)("p",null,"Use the ",Object(f.jsx)("code",null,"elasticsearch.NewDefaultClient()")," function to create the client with the default settings.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"go"},g.a`
es, err := elasticsearch.NewDefaultClient()
if err != nil {
log.Fatalf("Error creating the client: %s", err)
}
res, err := es.Info()
if err != nil {
log.Fatalf("Error getting response: %s", err)
}
defer res.Body.Close()
log.Println(res)
`),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"If you are using Elastic Cloud, the client offers an easy way to connect to it. You must pass your Cloud ID to the client, which is found in the Cloud console, as well as a corresponding API key.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"go"},g.a`
cfg := elasticsearch.Config{
CloudID: "${e}",
APIKey: "API_KEY"
}
es, err := elasticsearch.NewClient(cfg)
`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"To set the cluster endpoint(s) programmatically, pass a configuration object to the"," ",Object(f.jsx)("code",null,"elasticsearch.NewClient()")," function. To set the username and password, include them in the endpoint URL, or use the corresponding configuration options.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"go"},g.a`
cfg := elasticsearch.Config{
Addresses: []string{
"http://localhost:9200",
"http://localhost:9201",
},
Username: "",
Password: "",
}
es, err := elasticsearch.NewClient(cfg)
`))),y=()=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The Elasticsearch Java API Client includes all the features you need to add search to a Java application:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"Strongly typed requests and responses for all Elasticsearch APIs."),Object(f.jsx)("li",null,"Blocking and asynchronous versions of all APIs."),Object(f.jsx)("li",null,"Use of fluent builders and functional patterns to allow writing concise yet readable code when creating complex nested structures."),Object(f.jsx)("li",null,"Seamless integration of application classes by using an object mapper such as Jackson or any JSON-B implementation.")),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsJavaIntroduction},"Learn more about the Elasticsearch JAVA API client"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-java"},"The Elasticsearch JAVA API client on Github")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"There are several ways to install the Java API client."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsJavaInstallation},"Visit the client documentation to learn more"),"."),Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"The client is structured around three main components:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,Object(f.jsx)("strong",null,"API client classes.")," These provide strongly typed data structures and methods for Elasticsearch APIs. Since the Elasticsearch API is large, it is structured in feature groups (also called “namespaces”), each having its own client class. Elasticsearch core features are implemented in the ElasticsearchClient class."),Object(f.jsx)("li",null,Object(f.jsx)("strong",null,"A JSON object mapper.")," This maps your application classes to JSON and seamlessly integrates them with the API client."),Object(f.jsx)("li",null,Object(f.jsx)("strong",null,"A transport layer implementation.")," This is where all HTTP request handling takes place.")),Object(f.jsx)("p",null,"The code snippet below creates and wires these three components together:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"java"},g.a`
// Create the low-level client
RestClient restClient = RestClient.builder(
new HttpHost("localhost", 9200)).build();
// Create the transport with a Jackson mapper
ElasticsearchTransport transport = new RestClientTransport(
restClient, new JacksonJsonpMapper());
// And create the API client
ElasticsearchClient client = new ElasticsearchClient(transport);
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"Authentication is managed by the"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsJavaRestLow},"Java Low Level REST Client"),". For further details on configuring authentication, refer to"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsJavaBasicAuthentication},"its documentation"),"."))),S=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"This is the official Node.js client for Elasticsearch includes all the features you need to add search to any Node.js application:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"One-to-one mapping with REST API."),Object(f.jsx)("li",null,"Generalized, pluggable architecture."),Object(f.jsx)("li",null,"Configurable, automatic discovery of cluster nodes."),Object(f.jsx)("li",null,"Persistent, Keep-Alive connections."),Object(f.jsx)("li",null,"Load balancing across all available nodes."),Object(f.jsx)("li",null,"Child client support."),Object(f.jsx)("li",null,"TypeScript support out of the box.")),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsJsIntro},"Learn more about the official Node.js client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-js"},"The official Node.js client for Elasticsearch on Github")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"To install the latest version of the client, run the following command:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},"npm install @elastic/elasticsearch"),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"If you are using Elastic Cloud, the client offers an easy way to connect to it via the cloud option. You must pass the Cloud ID that you can find in the cloud console, then your username and password inside the auth option.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"javascript"},g.a`
const { Client } = require('@elastic/elasticsearch')
const client = new Client({
cloud: {
id: '${e}',
},
auth: {
username: '',
password: ''
}
})`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"There are several ways to connect and authenticate to Elasticsearch running outside of Cloud, including API keys, bearer tokens, and basic authentication."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsJsClientConnecting},"Visit the client’s documentation to learn more"),".")))),k=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"This official PHP client for Elasticsearch is designed to be a low-level client that does not stray from the Elasticsearch REST API."),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsPhpOverview},"Learn more about the official PHP client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-php"},"The official PHP client for Elasticsearch on Github")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"To install the latest version of the client, run the following command:"),Object(f.jsx)("p",null,"Elasticsearch-php only has four requirements that you need to pay attention:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"PHP 7.1.0 or higher"),Object(f.jsx)("li",null,Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"http://getcomposer.org/"},"Composer")),Object(f.jsx)("li",null,Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"http://php.net/manual/en/book.curl.php"},"ext-curl"),": the Libcurl extension for PHP"),Object(f.jsx)("li",null,"Native JSON Extensions (ext-json) 1.3.7 or higher")),Object(f.jsx)("p",null,"The rest of the dependencies are automatically downloaded and installed by Composer. Composer is a package and dependency manager for PHP and makes it easy to install Elasticsearch-php."),Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsPhpInstallation},"Visit the documentation for more information.")),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"You can connect to Elastic Cloud using ",Object(f.jsx)("strong",null,"Basic authentication")," or an"," ",Object(f.jsx)("strong",null,"API key"),". Where ",""," is reported in the Deployment UI. For basic authentication, ",""," and ",""," are generated when you deploy a new cloud instance. You’ll need to store the ",""," and ",""," since they will not be available via UI.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"php"},g.a`
// Connect via basic authentication
$client = ClientBuilder::create()
->setElasticCloudId('${e}')
->setBasicAuthentication('', '')
->build();
// Connect with an API key
$client = ClientBuilder::create()
->setElasticCloudId('${e}')
->setApiKey('', '')
->build();
`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"There are several ways to connect and authenticate to Elasticsearch running outside of Cloud, including API keys, bearer tokens, and basic authentication."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsPhpConnecting},"Visit the client’s documentation to learn more"),".")))),v=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"elasticsearch-py, the official Python client for Elasticsearch, is a low-level client for interacting with Elasticsearch’s REST API. It’s designed to be unopinionated and extendable."),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsPythonOverview},"Learn more about the Python client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://elasticsearch-py.readthedocs.io/"},"The Python client for Elasticsearch on Read the Docs"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-py"},"elasticsearch-py on Github")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"Install the ",Object(f.jsx)("code",null,"elasticsearch")," package with"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://pypi.org/project/elasticsearch"},"pip"),":")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
$ python -m pip install elasticsearch
`),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"If your application uses async/await in Python you can install the client with the async extra:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
$ python -m pip install elasticsearch[async]
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"Learn more about"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://pypi.org/project/elasticsearch"},"using asyncio with this project"),".")),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"Cloud ID is an easy way to configure your client to work with your Elastic Cloud deployment. Combine the cloud_id with either basic_auth or api_key to authenticate with your Elastic Cloud deployment."),Object(f.jsx)("p",null,"Using cloud_id enables TLS verification and HTTP compression by default and sets the port to 443 unless otherwise overwritten via the port parameter or the port value encoded within cloud_id. Using Cloud ID also disables sniffing as a proxy is in use.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"python"},g.a`
from elasticsearch import Elasticsearch
es = Elasticsearch(
cloud_id="${e}"
)
`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"A single node can be specified via a ",Object(f.jsx)("code",null,"scheme"),", ",Object(f.jsx)("code",null,"host"),","," ",Object(f.jsx)("code",null,"port"),", and optional ",Object(f.jsx)("code",null,"path_prefix"),". These values can either be specified manually via a URL in a string, dictionary,",Object(f.jsx)("code",null,"NodeConfig"),", or a list of these values. You must specify at least"," ",Object(f.jsx)("code",null,"scheme"),", ",Object(f.jsx)("code",null,"host")," and ",Object(f.jsx)("code",null,"port"),"for each node. All of the following are valid configurations:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"python"},g.a`
from elasticsearch import Elasticsearch
# Single node via URL
es = Elasticsearch("http://localhost:9200")
# Multiple nodes via URL
es = Elasticsearch([
"http://localhost:9200",
"http://localhost:9201",
"http://localhost:9202"
])
# Single node via dictionary
es = Elasticsearch({"scheme": "http", "host": "localhost", "port": 9200})
# Multiple nodes via dictionary
es = Elasticsearch([
{"scheme": "http", "host": "localhost", "port": 9200},
{"scheme": "http", "host": "localhost", "port": 9201},
])
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"There are several ways to authenticate to Elasticsearch running outside of Cloud, including API keys, bearer tokens, and basic authentication."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsPythonAuthentication},"Visit the client’s documentation to learn more"),".")))),C=({cloudId:e})=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The ",Object(f.jsx)("code",null,"elasticsearch")," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"http://rubygems.org/gems/elasticsearch"},"Rubygem")," ","provides a low-level client for communicating with an Elasticsearch cluster, fully compatible with other official clients."),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsRubyOverview},"Learn more about the Ruby client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-ruby"},"The Elasticsearch Ruby client on Github"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"http://rubydoc.info/gems/elasticsearch"},"The Elasticsearch Ruby client on RubyDoc"),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)("p",null,"Check out these other official Ruby libraries for working with Elasticsearch:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://github.com/elasticsearch/elasticsearch-rails"},"elasticsearch-rails")," ","- integration with Ruby models and Rails applications."),Object(f.jsx)("li",null,Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://github.com/elastic/elasticsearch-ruby/tree/7.17/elasticsearch-extensions"},"elasticsearch-extensions"),", deprecated."),Object(f.jsx)("li",null,Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://github.com/elastic/elasticsearch-dsl-ruby"},"elasticsearch-dsl")," ","which provides a Ruby API for the"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.queryDsl},"Elasticsearch Query DSL"),"."))),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"Install the ",Object(f.jsx)("code",null,"elasticsearch")," gem from Rubygems:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"shell"},g.a`
$ gem install elasticsearch
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"Or add it to your project’s Gemfile:")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0},g.a`
gem 'elasticsearch', ''
`),Object(f.jsx)(u.EuiSpacer,null),e?Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elastic Cloud"),Object(f.jsx)("p",null,"If you are using Elastic Cloud, the client offers an easy way to connect to it. You must pass the Cloud ID that you can find in the cloud console."),Object(f.jsx)("p",null,"You can connect to Elastic Cloud using ",Object(f.jsx)("strong",null,"Basic authentication")," or an"," ",Object(f.jsx)("strong",null,"API key"),". Where ",""," is reported in the Deployment UI. For basic authentication, ",""," and ",""," are generated when you deploy a new cloud instance. You’ll need to store the ",""," and ",""," since they will not be available via UI.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0,language:"ruby"},g.a`
require 'elasticsearch'
// Connect via basic authentication
client = Elasticsearch::Client.new(
cloud_id: '${e}'
user: '',
password: '',
)
// Connect via API key
client = Elasticsearch::Client.new(
cloud_id: '${e}',
api_key: {id: '', api_key: ''}
)
`)):Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Connecting to Elasticsearch"),Object(f.jsx)("p",null,"There are several ways to authenticate to Elasticsearch running outside of Cloud, including API keys, bearer tokens, and basic authentication."," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:h.a.clientsRubyAuthentication},"Visit the client’s documentation to learn more"),".")))),w=()=>Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The official Rust client for Elasticsearch includes all the features you need to add search to a Rust application:"),Object(f.jsx)("ul",null,Object(f.jsx)("li",null,"Fluent builders for all Elasticsearch REST API endpoints"),Object(f.jsx)("li",null,"Persistent keep-alive connections"),Object(f.jsx)("li",null,"TLS support with system or custom certificates"),Object(f.jsx)("li",null,"Proxy support with authentication"),Object(f.jsx)("li",null,"Async support with Tokio")),Object(f.jsx)(u.EuiLink,{target:"_blank",href:h.a.clientsRustOverview},"Learn more about the Rust client for Elasticsearch"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://github.com/elastic/elasticsearch-rs"},"The official Rust client for Elasticsearch on Github"),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(u.EuiLink,{target:"_blank",href:"https://docs.rs/elasticsearch"},"View the documentation on docs.rs")),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h4",null,"Installation"),Object(f.jsx)("p",null,"Add ",Object(f.jsx)("code",null,"elasticsearch")," crate and version to Cargo.toml.")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0},g.a`
[dependencies]
elasticsearch = ""
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The following optional dependencies may also be useful to create requests and read responses")),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiCodeBlock,{fontSize:"m",isCopyable:!0},g.a`
serde = "~1"
serde_json = "~1"
`),Object(f.jsx)(u.EuiSpacer,{size:"s"}),Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,"The client also includes"," ",Object(f.jsx)("a",{target:"_blank",rel:"noopener",href:"https://github.com/elastic/elasticsearch-rs#async-support-with-tokio"},"async support with tokio"),"."))),I=({language:e})=>{const t=(()=>{const{cloud:e}=Object(d.useValues)(x.a);return null==e?void 0:e.cloudId})();switch(e){case"dotnet":return Object(f.jsx)(E,null);case"go":return Object(f.jsx)(m,{cloudId:t});case"java":return Object(f.jsx)(y,null);case"javascript":return Object(f.jsx)(S,{cloudId:t});case"php":return Object(f.jsx)(k,{cloudId:t});case"python":return Object(f.jsx)(v,{cloudId:t});case"ruby":return Object(f.jsx)(C,{cloudId:t});case"rust":return Object(f.jsx)(w,null);default:return null}};var T=s(76),z=s(33),A=s(49);const P=e=>{e.target.select()},F=(e,t)=>()=>{e(),t({action:"clicked",metric:"cloud_id"})},L=()=>{const e=Object(T.a)(),{sendEnterpriseSearchTelemetry:t}=Object(d.useActions)(A.d),{http:s}=Object(d.useValues)(z.a);return e.cloudId?Object(f.jsx)(u.EuiPanel,{color:"subdued",grow:!1,"data-test-subj":"CloudIdPanel"},Object(f.jsx)(u.EuiFlexGroup,{justifyContent:"spaceBetween",alignItems:"center",responsive:!0},Object(f.jsx)(u.EuiFlexItem,null,Object(f.jsx)(u.EuiFlexGroup,{gutterSize:"s",alignItems:"center",responsive:!1},Object(f.jsx)(u.EuiFlexItem,null,Object(f.jsx)(u.EuiTitle,{size:"xs"},Object(f.jsx)("h2",null,j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchCloudId.heading",{defaultMessage:"My Deployment"})))))),Object(f.jsx)(u.EuiFlexItem,{grow:!1},Object(f.jsx)(u.EuiLink,{href:e.deploymentUrl,target:"_blank","data-test-subj":"cloudManageLink"},j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchCloudId.manageLink",{defaultMessage:"Manage"})))),Object(f.jsx)(u.EuiFlexGroup,{direction:"column",gutterSize:"m"},Object(f.jsx)(u.EuiFlexItem,null,Object(f.jsx)(u.EuiForm,{component:"form"},Object(f.jsx)(u.EuiFormRow,{label:j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchCloudId.cloudIdLabel",{defaultMessage:"Cloud ID"})},Object(f.jsx)(u.EuiFieldText,{onFocus:P,value:e.cloudId,compressed:!0,readOnly:!0,append:Object(f.jsx)(u.EuiCopy,{textToCopy:e.cloudId},(e=>Object(f.jsx)(u.EuiButtonIcon,{iconType:"copyClipboard",onClick:F(e,t),iconSize:"m","data-test-subj":"CopyCloudIdButton","aria-label":j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchCloudId.copyCloudIdAriaLabel",{defaultMessage:"Copy Cloud ID"})})))})))),Object(f.jsx)(u.EuiFlexItem,null,Object(f.jsx)(u.EuiButton,{href:`${s.basePath.publicBaseUrl}/app/management/security/api_keys`},j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchCloudId.manageApiKeysLink",{defaultMessage:"Manage API keys"}))))):null};var _=s(41),R=s.n(_),N=s(1),G=s(53);const M=({children:e,pageChrome:t,pageViewTelemetry:s,...a})=>Object(f.jsx)(G.a,R()({},a,{solutionNav:{name:N.h.NAME,items:Object(G.d)()},setPageChrome:t&&Object(f.jsx)(p.c,{trail:t})}),s&&Object(f.jsx)(A.b,{action:"viewed",metric:s}),e),B=()=>{const e=[{value:"dotnet",text:".Net"},{value:"go",text:"Go"},{value:"java",text:"Java"},{value:"javascript",text:"JavaScript"},{value:"php",text:"PHP"},{value:"python",text:"Python"},{value:"ruby",text:"Ruby"},{value:"rust",text:"Rust"}],t=o.a.parse(window.location.search).client,s=e.some((e=>e.value===t)),[l,c]=Object(a.useState)(s?t:"java"),i=Object(u.useGeneratedHtmlId)({prefix:"languageSelect"});return Object(a.useEffect)((()=>{window.scrollTo(0,0)}),[]),Object(f.jsx)(M,null,Object(f.jsx)(p.c,null),Object(f.jsx)(u.EuiFlexGroup,{alignItems:"flexStart","data-test-subj":"elasticsearchGuide"},Object(f.jsx)(u.EuiFlexItem,{grow:3,style:{maxWidth:800}},Object(f.jsx)(u.EuiText,null,Object(f.jsx)("h2",null,j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchTitle",{defaultMessage:"Getting started with Elasticsearch"})),Object(f.jsx)("p",null,j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchDescription",{defaultMessage:"Elasticsearch provides the low-level tools you need to build fast, relevant search for your website or application. Because it's powerful and flexible, Elasticsearch can handle search use cases of all shapes and sizes."}))),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiSteps,{headingElement:"h2",steps:[{title:j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.connectToElasticsearchTitle",{defaultMessage:"Connect to Elasticsearch"}),children:Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.connectToElasticsearchDescription",{defaultMessage:"Elastic builds and maintains clients in several popular languages and our community has contributed many more."})),Object(f.jsx)(u.EuiLink,{href:h.a.clientsGuide,target:"_blank"},j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchClientsLink",{defaultMessage:"Learn more about Elasticsearch clients"}))),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(u.EuiSelect,{prepend:j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchClientsSelectLabel",{defaultMessage:"Select a client"}),id:i,options:e,value:l,onChange:e=>(e=>{c(e.target.value)})(e),"aria-label":j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchClientsSelectAriaLabel",{defaultMessage:"Language client"})}),Object(f.jsx)(u.EuiSpacer,{size:"m"}),Object(f.jsx)(I,{language:l}))},{title:j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchSearchExperienceTitle",{defaultMessage:"Build a search experience with Elasticsearch"}),children:Object(f.jsx)(n.a.Fragment,null,Object(f.jsx)(u.EuiText,null,Object(f.jsx)("p",null,j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchSearchExperienceDescription",{defaultMessage:"Ready to add an engaging, modern search experience to your application or website? Search UI, Elastic’s JavaScript search framework for building world-class search experiences, was made for the task."}))),Object(f.jsx)(u.EuiSpacer,{size:"l"}),Object(f.jsx)(u.EuiFlexGroup,{gutterSize:"l",alignItems:"center"},Object(f.jsx)(u.EuiFlexItem,{grow:!1},Object(f.jsx)(u.EuiText,null,Object(f.jsx)(u.EuiLink,{href:"https://www.elastic.co/enterprise-search/search-ui",target:"_blank"},j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchSearchUIMarketingLink",{defaultMessage:"Learn more about Search UI"})))),Object(f.jsx)(u.EuiFlexItem,{grow:!1},Object(f.jsx)(u.EuiText,null,Object(f.jsx)(u.EuiLink,{href:"https://github.com/elastic/search-ui",target:"_blank"},j.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchGuide.elasticsearchSearchUIGitHubLink",{defaultMessage:"Search UI on GitHub"}))))))}]})),Object(f.jsx)(u.EuiFlexItem,{grow:1},Object(f.jsx)(L,null),Object(f.jsx)(u.EuiSpacer,null),Object(f.jsx)(b.a,null))))},U=e=>{const{enterpriseSearchVersion:t,kibanaVersion:s}=e,a=Object(c.a)(t,s);return Object(f.jsx)(l.c,null,Object(f.jsx)(l.a,{exact:!0,path:"/"},a?Object(f.jsx)(i.a,{enterpriseSearchVersion:t,kibanaVersion:s}):Object(f.jsx)(B,null)))}},123:function(e,t,s){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},124:function(e,t,s){"use strict";var a="%[a-f0-9]{2}",n=new RegExp("("+a+")|([^%]+?)","gi"),l=new RegExp("("+a+")+","gi");function c(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var s=e.slice(0,t),a=e.slice(t);return Array.prototype.concat.call([],c(s),c(a))}function i(e){try{return decodeURIComponent(e)}catch(a){for(var t=e.match(n)||[],s=1;s{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const s=e.indexOf(t);return-1===s?[e]:[e.slice(0,s),e.slice(s+t.length)]}},239:function(e,t,s){"use strict";s.d(t,"a",(function(){return o}));var a=s(10),n=s.n(a),l=s(12),c=s(2),i=s(4),r=s(11);const o=()=>Object(r.jsx)(n.a.Fragment,null,Object(r.jsx)(l.EuiTitle,{size:"xs"},Object(r.jsx)("h4",null,c.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchResources.title",{defaultMessage:"Resources"}))),Object(r.jsx)(l.EuiSpacer,{size:"s"}),Object(r.jsx)(l.EuiSpacer,{size:"xs"}),Object(r.jsx)(l.EuiLink,{href:i.a.elasticsearchGettingStarted,target:"_blank"},c.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchResources.gettingStarted",{defaultMessage:"Getting started with Elasticsearch"})),Object(r.jsx)(l.EuiSpacer,{size:"s"}),Object(r.jsx)(l.EuiSpacer,{size:"xs"}),Object(r.jsx)(l.EuiLink,{href:i.a.elasticsearchCreateIndex,target:"_blank"},c.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchResources.createIndex",{defaultMessage:"Create a new index"})),Object(r.jsx)(l.EuiSpacer,{size:"s"}),Object(r.jsx)(l.EuiSpacer,{size:"xs"}),Object(r.jsx)(l.EuiLink,{href:i.a.clientsGuide,target:"_blank"},c.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchResources.elasticsearchClients",{defaultMessage:"Setup a language client"})),Object(r.jsx)(l.EuiSpacer,{size:"s"}),Object(r.jsx)(l.EuiSpacer,{size:"xs"}),Object(r.jsx)(l.EuiLink,{href:"https://github.com/elastic/search-ui/tree/master/packages/search-ui-elasticsearch-connector",target:"_blank"},c.i18n.translate("xpack.enterpriseSearch.overview.elasticsearchResources.searchUi",{defaultMessage:"Search UI for Elasticsearch"})))},64:function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));const a=(e,t)=>{if(!e||!t)return!1;const[s,a]=e.split("."),[n,l]=t.split(".");return s!==n||a!==l}},66:function(e,t,s){"use strict";s.d(t,"a",(function(){return u}));var a=s(10),n=s.n(a),l=s(73),c=s(12),i=s(2),r=s(11);const o=({enterpriseSearchVersion:e,kibanaVersion:t})=>Object(r.jsx)(c.EuiEmptyPrompt,{iconType:"warning",iconColor:"danger",title:Object(r.jsx)("h2",null,i.i18n.translate("xpack.enterpriseSearch.versionMismatch.title",{defaultMessage:"Incompatible version error"})),titleSize:"l",body:Object(r.jsx)(n.a.Fragment,null,i.i18n.translate("xpack.enterpriseSearch.versionMismatch.body",{defaultMessage:"Your Kibana and Enterprise Search versions do not match. To access Enterprise Search, use the same major and minor version for each service."}),Object(r.jsx)(c.EuiSpacer,null),Object(r.jsx)("div",null,i.i18n.translate("xpack.enterpriseSearch.versionMismatch.enterpriseSearchVersionText",{defaultMessage:"Enterprise Search version: {enterpriseSearchVersion}",values:{enterpriseSearchVersion:e}})),Object(r.jsx)("div",null,i.i18n.translate("xpack.enterpriseSearch.versionMismatch.kibanaVersionText",{defaultMessage:"Kibana version: {kibanaVersion}",values:{kibanaVersion:t}})))}),u=e=>Object(r.jsx)(l.a,{isEmptyState:!0},Object(r.jsx)(o,e))},67:function(e,t,s){"use strict";e.exports=function(e){var t=void 0;t="string"==typeof e?[e]:e.raw;for(var s="",a=0;a{const{cloud:e}=Object(a.useValues)(n.a);return{cloudId:null==e?void 0:e.cloudId,deploymentUrl:null==e?void 0:e.deploymentUrl,elasticsearchUrl:null==e?void 0:e.elasticsearchUrl,kibanaUrl:null==e?void 0:e.kibanaUrl}}},85:function(e,t,s){"use strict";const a=s(123),n=s(124),l=s(125);function c(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function i(e,t){return t.encode?t.strict?a(e):encodeURIComponent(e):e}function r(e,t){return t.decode?n(e):e}function o(e){return Array.isArray(e)?e.sort():"object"==typeof e?o(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function u(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function j(e){const t=(e=u(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function h(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function b(e,t){c((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const s=function(e){let t;switch(e.arrayFormat){case"index":return(e,s,a)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===a[e]&&(a[e]={}),a[e][t[1]]=s):a[e]=s};case"bracket":return(e,s,a)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==a[e]?a[e]=[].concat(a[e],s):a[e]=[s]:a[e]=s};case"comma":case"separator":return(t,s,a)=>{const n="string"==typeof s&&s.split("").indexOf(e.arrayFormatSeparator)>-1?s.split(e.arrayFormatSeparator).map((t=>r(t,e))):null===s?s:r(s,e);a[t]=n};default:return(e,t,s)=>{void 0!==s[e]?s[e]=[].concat(s[e],t):s[e]=t}}}(t),a=Object.create(null);if("string"!=typeof e)return a;if(!(e=e.trim().replace(/^[?#&]/,"")))return a;for(const n of e.split("&")){let[e,c]=l(t.decode?n.replace(/\+/g," "):n,"=");c=void 0===c?null:["comma","separator"].includes(t.arrayFormat)?c:r(c,t),s(r(e,t),c,a)}for(const e of Object.keys(a)){const s=a[e];if("object"==typeof s&&null!==s)for(const e of Object.keys(s))s[e]=h(s[e],t);else a[e]=h(s,t)}return!1===t.sort?a:(!0===t.sort?Object.keys(a).sort():Object.keys(a).sort(t.sort)).reduce(((e,t)=>{const s=a[t];return Boolean(s)&&"object"==typeof s&&!Array.isArray(s)?e[t]=o(s):e[t]=s,e}),Object.create(null))}t.extract=j,t.parse=b,t.stringify=(e,t)=>{if(!e)return"";c((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const s=s=>t.skipNull&&null==e[s]||t.skipEmptyString&&""===e[s],a=function(e){switch(e.arrayFormat){case"index":return t=>(s,a)=>{const n=s.length;return void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,[i(t,e),"[",n,"]"].join("")]:[...s,[i(t,e),"[",i(n,e),"]=",i(a,e)].join("")]};case"bracket":return t=>(s,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,[i(t,e),"[]"].join("")]:[...s,[i(t,e),"[]=",i(a,e)].join("")];case"comma":case"separator":return t=>(s,a)=>null==a||0===a.length?s:0===s.length?[[i(t,e),"=",i(a,e)].join("")]:[[s,i(a,e)].join(e.arrayFormatSeparator)];default:return t=>(s,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?s:null===a?[...s,i(t,e)]:[...s,[i(t,e),"=",i(a,e)].join("")]}}(t),n={};for(const t of Object.keys(e))s(t)||(n[t]=e[t]);const l=Object.keys(n);return!1!==t.sort&&l.sort(t.sort),l.map((s=>{const n=e[s];return void 0===n?"":null===n?i(s,t):Array.isArray(n)?n.reduce(a(s),[]).join("&"):i(s,t)+"="+i(n,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[s,a]=l(e,"#");return Object.assign({url:s.split("?")[0]||"",query:b(j(e),t)},t&&t.parseFragmentIdentifier&&a?{fragmentIdentifier:r(a,t)}:{})},t.stringifyUrl=(e,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=u(e.url).split("?")[0]||"",n=t.extract(e.url),l=t.parse(n,{sort:!1}),c=Object.assign(l,e.query);let r=t.stringify(c,s);r&&(r=`?${r}`);let o=function(e){let t="";const s=e.indexOf("#");return-1!==s&&(t=e.slice(s)),t}(e.url);return e.fragmentIdentifier&&(o=`#${i(e.fragmentIdentifier,s)}`),`${a}${r}${o}`}}}]);