apoc.es.postRaw

Procedure APOC Full

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

Signature

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

Input parameters

Name Type Default

host

STRING?

null

path

STRING?

null

payload

ANY?

null

config

MAP?

{}

Output parameters

Name Type

value

MAP?

Usage Examples

The examples in this section are based on the following Elastic instance:

version: '3.5'
services:
  elastic:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
    ports:
      - 9200:9200
      - 9300:9300
    environment:
      - discovery.type=single-node

with a dataset created by downloading this file, and executing the command:

curl -H 'Content-Type: application/json' -XPOST 'localhost:9200/bank/_bulk?pretty&refresh' --data-binary '@accounts.json'

We can create a document with a name property of John Doe in the customers index, by running the following query:

CALL apoc.es.postRaw("localhost","customers/_doc", {
  name: "John Doe"
});
Table 1. Results
value

{result: "created", _shards: {total: 2, failed: 0, successful: 1}, _seq_no: 8, _index: "customers", _type: "_doc", _id: "JG43_3UBi9jUSsIzOYJL", _version: 1, _primary_term: 1}