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

Fixes #2136: Support for additional HTTP headers in apoc.es procedures #3953

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.get.adoc[apoc.es.get icon:book[]] +

`apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value` - perform a GET operation on elastic search
`apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value` - perform a GET operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.getRaw.adoc[apoc.es.getRaw icon:book[]] +

`apoc.es.getRaw(host-or-port,path,payload-or-null) yield value` - perform a raw GET operation on elastic search
`apoc.es.getRaw(host-or-port,path,payload-or-null,$config) yield value` - perform a raw GET operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.post.adoc[apoc.es.post icon:book[]] +

`apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value` - perform a POST operation on elastic search
`apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value` - perform a POST operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.postRaw.adoc[apoc.es.postRaw icon:book[]] +

`apoc.es.postRaw(host-or-port,path,payload-or-null) yield value` - perform a raw POST operation on elastic search
`apoc.es.postRaw(host-or-port,path,payload-or-null,$config) yield value` - perform a raw POST operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.put.adoc[apoc.es.put icon:book[]] +

`apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value` - perform a PUT operation on elastic search
`apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value` - perform a PUT operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.query.adoc[apoc.es.query icon:book[]] +

`apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value` - perform a SEARCH operation on elastic search
`apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value` - perform a SEARCH operation on elastic search
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
¦xref::overview/apoc.es/apoc.es.stats.adoc[apoc.es.stats icon:book[]] +

`apoc.es.stats(host-url-Key)` - elastic search statistics
`apoc.es.stats(host-url-Key,$config)` - elastic search statistics
¦label:procedure[]
¦label:apoc-extended[]
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ This example was tested on a Mac Book Pro with 16GB of RAM. Loading 20000 docume

[source,cypher]
----
call apoc.es.post(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value
call apoc.es.post(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value
// GET/PUT/POST url/index/type/id?query -d payload
----
Expand Down Expand Up @@ -180,6 +180,34 @@ Query can be a map which is turned into a query string, a direct string or null

Payload can be a *map* which will be turned into a json payload or a string which will be sent directly or null.

=== config parameter

Config can be an optional *map*, which can have the following entries:

.Config parameters
[opts=header, cols="1,1,1,4"]
|===
| name | type | default | description
| headers | `Map` | {`content-type`: "application/json", `method`, "<httpMethod>"} | Contains a header map to add (or replace) the default one.
The `method: <httpMethod>` is needed by APOC to figure out under the hood, which http request method to pass.
That is, by default, it is `PUT` with the `apoc.es.put`, POST with the `apoc.es.post` and `apoc.es.postRaw`, and GET in other cases.
|===


For example, by using the `apoc.es.stats`, we can execute:
[source, cypher]
----
CALL apoc.es.stats('custom', { headers: {Authorization: "Basic <Base64Token>"} })
----

to use a https://www.elastic.co/guide/en/elasticsearch/reference/current/http-clients.html[Basic authentication]
and create the following HTTP header:
```
Authorization: Basic <Base64Token>
method: GET
Content-Type: application/json
```


=== Results

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a GET operation on elastic search
apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a GET operation on elastic search

== Signature

[source]
----
apoc.es.get(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, query :: ANY?, payload :: ANY?) :: (value :: MAP?)
apoc.es.get(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, query :: ANY?, payload :: ANY?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -27,6 +27,7 @@ apoc.es.get(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, q
|id|STRING?|null
|query|ANY?|null
|payload|ANY?|null
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.getRaw(host-or-port,path,payload-or-null) yield value - perform a raw GET operation on elastic search
apoc.es.getRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw GET operation on elastic search

== Signature

[source]
----
apoc.es.getRaw(host :: STRING?, path :: STRING?, payload :: ANY?) :: (value :: MAP?)
apoc.es.getRaw(host :: STRING?, path :: STRING?, payload :: ANY?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -24,6 +24,7 @@ apoc.es.getRaw(host :: STRING?, path :: STRING?, payload :: ANY?) :: (value :: M
|host|STRING?|null
|path|STRING?|null
|payload|ANY?|null
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a POST operation on elastic search
apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a POST operation on elastic search

== Signature

[source]
----
apoc.es.post(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?, payload = {} :: MAP?) :: (value :: MAP?)
apoc.es.post(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?, payload = {} :: MAP?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -26,6 +26,7 @@ apoc.es.post(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?,
|type|STRING?|null
|query|ANY?|null
|payload|MAP?|{}
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.postRaw(host-or-port,path,payload-or-null) yield value - perform a raw POST operation on elastic search
apoc.es.postRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw POST operation on elastic search

== Signature

[source]
----
apoc.es.postRaw(host :: STRING?, path :: STRING?, payload :: ANY?) :: (value :: MAP?)
apoc.es.postRaw(host :: STRING?, path :: STRING?, payload :: ANY?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -24,6 +24,7 @@ apoc.es.postRaw(host :: STRING?, path :: STRING?, payload :: ANY?) :: (value ::
|host|STRING?|null
|path|STRING?|null
|payload|ANY?|null
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a PUT operation on elastic search
apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a PUT operation on elastic search

== Signature

[source]
----
apoc.es.put(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, query :: ANY?, payload = {} :: MAP?) :: (value :: MAP?)
apoc.es.put(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, query :: ANY?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -27,6 +27,7 @@ apoc.es.put(host :: STRING?, index :: STRING?, type :: STRING?, id :: STRING?, q
|id|STRING?|null
|query|ANY?|null
|payload|MAP?|{}
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a SEARCH operation on elastic search
apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a SEARCH operation on elastic search

== Signature

[source]
----
apoc.es.query(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?, payload :: ANY?) :: (value :: MAP?)
apoc.es.query(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?, payload :: ANY?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
Expand All @@ -26,6 +26,7 @@ apoc.es.query(host :: STRING?, index :: STRING?, type :: STRING?, query :: ANY?,
|type|STRING?|null
|query|ANY?|null
|payload|ANY?|null
|config|MAP?|{}
|===

== Output parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ This file is generated by DocsTest, so don't change it!
label:procedure[] label:apoc-extended[]

[.emphasis]
apoc.es.stats(host-url-Key) - elastic search statistics
apoc.es.stats(host-url-Key,$config) - elastic search statistics

== Signature

[source]
----
apoc.es.stats(host :: STRING?) :: (value :: MAP?)
apoc.es.stats(host :: STRING?, payload = {} :: MAP?, config = {} :: MAP?) :: (value :: MAP?)
----

== Input parameters
[.procedures, opts=header]
|===
| Name | Type | Default
|host|STRING?|null
|config|MAP?|{}
|===

== Output parameters
Expand Down
14 changes: 7 additions & 7 deletions docs/asciidoc/modules/ROOT/pages/overview/apoc.es/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ This file is generated by DocsTest, so don't change it!
| Qualified Name | Type
|xref::overview/apoc.es/apoc.es.get.adoc[apoc.es.get icon:book[]]

apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a GET operation on elastic search
apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a GET operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.getRaw.adoc[apoc.es.getRaw icon:book[]]

apoc.es.getRaw(host-or-port,path,payload-or-null) yield value - perform a raw GET operation on elastic search
apoc.es.getRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw GET operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.post.adoc[apoc.es.post icon:book[]]

apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a POST operation on elastic search
apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a POST operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.postRaw.adoc[apoc.es.postRaw icon:book[]]

apoc.es.postRaw(host-or-port,path,payload-or-null) yield value - perform a raw POST operation on elastic search
apoc.es.postRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw POST operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.put.adoc[apoc.es.put icon:book[]]

apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a PUT operation on elastic search
apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a PUT operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.query.adoc[apoc.es.query icon:book[]]

apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a SEARCH operation on elastic search
apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a SEARCH operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.stats.adoc[apoc.es.stats icon:book[]]

apoc.es.stats(host-url-Key) - elastic search statistics
apoc.es.stats(host-url-Key,$config) - elastic search statistics
|label:procedure[]
|===

Original file line number Diff line number Diff line change
Expand Up @@ -209,31 +209,31 @@ Query a virtualized resource by name and return virtual nodes linked using virtu
| Qualified Name | Type
|xref::overview/apoc.es/apoc.es.get.adoc[apoc.es.get icon:book[]]

apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a GET operation on elastic search
apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a GET operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.getRaw.adoc[apoc.es.getRaw icon:book[]]

apoc.es.getRaw(host-or-port,path,payload-or-null) yield value - perform a raw GET operation on elastic search
apoc.es.getRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw GET operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.post.adoc[apoc.es.post icon:book[]]

apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a POST operation on elastic search
apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a POST operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.postRaw.adoc[apoc.es.postRaw icon:book[]]

apoc.es.postRaw(host-or-port,path,payload-or-null) yield value - perform a raw POST operation on elastic search
apoc.es.postRaw(host-or-port,path,payload-or-null,$config) yield value - perform a raw POST operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.put.adoc[apoc.es.put icon:book[]]

apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a PUT operation on elastic search
apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null,$config) yield value - perform a PUT operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.query.adoc[apoc.es.query icon:book[]]

apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a SEARCH operation on elastic search
apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null,$config) yield value - perform a SEARCH operation on elastic search
|label:procedure[]
|xref::overview/apoc.es/apoc.es.stats.adoc[apoc.es.stats icon:book[]]

apoc.es.stats(host-url-Key) - elastic search statistics
apoc.es.stats(host-url-Key,$config) - elastic search statistics
|label:procedure[]
|===

Expand Down