Skip to content

Commit 94cf43a

Browse files
ezimuelszabosteve
andauthored
[DOCS] Added the documentation for ELASTIC_CLIENT_URL_PLUS_AS_SPACE settings (#1311)
* Added the documentation for ELASTIC_CLIENT_URL_PLUS_AS_SPACE settings * Update docs/connecting.asciidoc Co-authored-by: István Zoltán Szabó <[email protected]> * Update docs/connecting.asciidoc Co-authored-by: István Zoltán Szabó <[email protected]> * Update docs/connecting.asciidoc Co-authored-by: István Zoltán Szabó <[email protected]> * Update docs/connecting.asciidoc Co-authored-by: István Zoltán Szabó <[email protected]> --------- Co-authored-by: István Zoltán Szabó <[email protected]>
1 parent b35ec5e commit 94cf43a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/connecting.asciidoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,30 @@ latest 7.x client and set the environment variable `ELASTIC_CLIENT_APIVERSIONING
215215
to `true`. The client is handling the rest internally. For every 8.0 and beyond
216216
client, you're all set! The compatibility mode is enabled by default.
217217

218+
[discrete]
219+
[[space-encode-url]]
220+
=== Space encode in URL
221+
222+
If you use a space character in an index name, elasticsearch-php converts it into
223+
a `+`, since this space must be encoded in a URL. The same applies to the `id` and `type`
224+
parameters.
225+
226+
Starting from Elasticsearch 7.4, a `+` in URL is encoded as `%2B` by all the REST
227+
API functionality. Prior versions handled a `+` as a single space. If your
228+
application requires handling `+` as a single space you can return to the old
229+
behaviour by setting the Elasticsearch system property `es.rest.url_plus_as_space` to `true`.
230+
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]
231+
for mote information.
232+
233+
Starting from elasticsearch-php 7.17.2, we introduced an environmental variable `ELASTIC_CLIENT_URL_PLUS_AS_SPACE`
234+
that can be used to encode a space using `+`, setting the variable to `true`.
235+
If `ELASTIC_CLIENT_URL_PLUS_AS_SPACE` is set to `false`, a space is encoded using `%20`
236+
as specified in https://www.rfc-editor.org/rfc/rfc3986[RFC 3986].
237+
238+
For instance, if you are using a space character in an index name, this will be
239+
encoded using a `+`, default behaviour. If you set `ELASTIC_CLIENT_URL_PLUS_AS_SPACE`
240+
to `false` the space in the index name will be encoded with `%20`.
241+
218242

219243
[discrete]
220244
[[client-usage]]

0 commit comments

Comments
 (0)