apoc.es.getRaw

This is the APOC Extended documentation.

APOC Extended is not supported by Neo4j. For the officially supported APOC Core, go to the APOC Core page.

Procedure Apoc Extended

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

Signature

apoc.es.getRaw(host :: STRING?, path :: STRING?, payload :: ANY?) :: (value :: MAP?)

Input parameters

Name Type Default

host

STRING?

null

path

STRING?

null

payload

ANY?

null

Output parameters

Name Type

value

MAP?

Usage Examples

The examples in this section are based on an Elastic instance populated with the accounts.json sample dataset from the Getting Started with Elasticsearch guide. You can find instructions for setting this up at github.com/neo4j-examples/elastic-example.

We can find the document with id 1, by running the following query:

CALL apoc.es.getRaw("localhost","bank/_doc/1",null);
Table 1. Results
value

{_seq_no: 0, found: TRUE, _index: "bank", _type: "_doc", _source: {account_number: 1, firstname: "Amber", address: "880 Holmes Lane", balance: 39225, gender: "M", city: "Brogan", employer: "Pyrami", state: "IL", age: 32, email: "amberduke@pyrami.com", lastname: "Duke"}, _id: "1", _version: 1, _primary_term: 1}

We can find the documents that have an address of mill lane, by running the following query:

CALL apoc.es.getRaw("localhost","bank/_search",{
  query: { match_phrase: { address: "mill lane" } }
});
Table 2. Results
value

{_shards: {total: 1, failed: 0, successful: 1, skipped: 0}, hits: {hits: [{_type: "_doc", _source: {account_number: 136, firstname: "Winnie", address: "198 Mill Lane", balance: 45801, gender: "M", city: "Urie", employer: "Neteria", state: "IL", age: 38, email: "winnieholland@neteria.com", lastname: "Holland"}, _id: "136", _index: "bank", _score: 9.507477}], total: {value: 1, relation: "eq"}, max_score: 9.507477}, took: 2, timed_out: FALSE}