Using the REST API
In order to communicate with the Elasticsearch node using the Martello iQ REST API, you need to have HTTP access to the Martello iQ server address and port 9200.
By default, the Elasticsearch node binds to loopback addresses only, i.e. 127.0.0.1 and [::1]. If you want to have access from other servers, the Elasticsearch node will need to bind to a non-loopback address. In the Elasticsearch configuration file “elasticsearch.yml” modify the setting “network.host” to make the node bind to a different hostname or IP address. For more details, please consult the Elasticsearch documentation.
The example below shows the pattern of how to access data in Elasticsearch:
<REST Verb> <Martello iQ Server>:9200/<Index>/<Type>/<_id> |
The REST verbs used to interact with Elasticsearch are GET (Retrieve/List), PUT (Create/Update), DELETE (Delete) and POST (Batch Processing).
For information about the <Index>, <Type>, and <_id> variables, see "Basic Components"
You can use command-line tools like curl , PowerShell’s Invoke-RestMethod or visual tools like Postman to perform REST requests.
To illustrate the Martello iQ REST API, we will make use of the curl syntax in the following examples. For simplicity the Unix syntax is adopted; if you use curl in a Microsoft Windows command prompt, you should replace all the single quotes ( ' ) with double quotes ( " ) and any double quote ( " ) inside single quotes with two double quotes ( "" ).