From b5d246e1f34e06aec080c77fbe86b10fb5e837aa Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Wed, 19 Apr 2023 13:01:28 +0200 Subject: [PATCH 1/5] Added the documentation for ELASTIC_CLIENT_URL_PLUS_AS_SPACE settings --- docs/connecting.asciidoc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index ae70256e5..7cc9a9c5f 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -215,6 +215,30 @@ latest 7.x client and set the environment variable `ELASTIC_CLIENT_APIVERSIONING to `true`. The client is handling the rest internally. For every 8.0 and beyond client, you're all set! The compatibility mode is enabled by default. +[discrete] +[[space-encode-url]] +=== Space encode in URL + +If you use a space character in an index name, elasticsearch-php will convert it into +a `+`, since this space must be encoded in a URL. The same applies for `id` and `type` +parameters. + +Starting from Elasticsearch 7.4, a `+` in URL will be encoded as `%2B` by all the REST +API functionality. Prior versions handled a `+` as a single space. If your +application requires handling `+` as a single space you can return to the old +behaviour by setting the Elasticsearch system property `es.rest.url_plus_as_space` to `true`. +You can read the https://www.elastic.co/guide/en/elasticsearch/reference/7.17/breaking-changes-7.4.html#_changes_to_encoding_plus_signs_in_urls[Elasticsearch release note] +for mote information. + +Starting from elasticsearch-php 7.17.2 we introduced an environmental variable `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` +that can be used to encode a space using `+`, setting the variable to `true`. +If `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` is set to `false` a space will be encoded using `%20` +as specified in https://www.rfc-editor.org/rfc/rfc3986[RFC 3986]. + +For instance, if you are using a space character in an index name, this will be +encoded using a `+`, default behaviour. If you set `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` +to `false` the space in the index name will be encoded with `%20`. + [discrete] [[client-usage]] From 42b17b026892ab6b3dfc51268a774a21bf0e7f47 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Thu, 20 Apr 2023 09:12:08 +0200 Subject: [PATCH 2/5] Update docs/connecting.asciidoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: István Zoltán Szabó --- docs/connecting.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index 7cc9a9c5f..9bf17fe17 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -219,8 +219,8 @@ client, you're all set! The compatibility mode is enabled by default. [[space-encode-url]] === Space encode in URL -If you use a space character in an index name, elasticsearch-php will convert it into -a `+`, since this space must be encoded in a URL. The same applies for `id` and `type` +If you use a space character in an index name, elasticsearch-php converts it into +a `+`, since this space must be encoded in a URL. The same applies to the `id` and `type` parameters. Starting from Elasticsearch 7.4, a `+` in URL will be encoded as `%2B` by all the REST From 73c31b6d01a3eb3693014b36fd995b1b59b66d13 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Thu, 20 Apr 2023 09:12:17 +0200 Subject: [PATCH 3/5] Update docs/connecting.asciidoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: István Zoltán Szabó --- docs/connecting.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index 9bf17fe17..39a0e2aba 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -230,7 +230,7 @@ behaviour by setting the Elasticsearch system property `es.rest.url_plus_as_spac You can read the https://www.elastic.co/guide/en/elasticsearch/reference/7.17/breaking-changes-7.4.html#_changes_to_encoding_plus_signs_in_urls[Elasticsearch release note] for mote information. -Starting from elasticsearch-php 7.17.2 we introduced an environmental variable `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` +Starting from elasticsearch-php 7.17.2, we introduced an environmental variable `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` that can be used to encode a space using `+`, setting the variable to `true`. If `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` is set to `false` a space will be encoded using `%20` as specified in https://www.rfc-editor.org/rfc/rfc3986[RFC 3986]. From f126cc0d9fd96707c7962713c25c3bd412589550 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Thu, 20 Apr 2023 09:12:25 +0200 Subject: [PATCH 4/5] Update docs/connecting.asciidoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: István Zoltán Szabó --- docs/connecting.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index 39a0e2aba..b9b7a8b7c 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -223,7 +223,7 @@ If you use a space character in an index name, elasticsearch-php converts it int a `+`, since this space must be encoded in a URL. The same applies to the `id` and `type` parameters. -Starting from Elasticsearch 7.4, a `+` in URL will be encoded as `%2B` by all the REST +Starting from Elasticsearch 7.4, a `+` in URL is encoded as `%2B` by all the REST API functionality. Prior versions handled a `+` as a single space. If your application requires handling `+` as a single space you can return to the old behaviour by setting the Elasticsearch system property `es.rest.url_plus_as_space` to `true`. From 8426e8f4cd5476ccc5a51c66d7054d99ee0c8bac Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Thu, 20 Apr 2023 09:12:31 +0200 Subject: [PATCH 5/5] Update docs/connecting.asciidoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: István Zoltán Szabó --- docs/connecting.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/connecting.asciidoc b/docs/connecting.asciidoc index b9b7a8b7c..de91e0975 100644 --- a/docs/connecting.asciidoc +++ b/docs/connecting.asciidoc @@ -232,7 +232,7 @@ for mote information. Starting from elasticsearch-php 7.17.2, we introduced an environmental variable `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` that can be used to encode a space using `+`, setting the variable to `true`. -If `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` is set to `false` a space will be encoded using `%20` +If `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` is set to `false`, a space is encoded using `%20` as specified in https://www.rfc-editor.org/rfc/rfc3986[RFC 3986]. For instance, if you are using a space character in an index name, this will be