This plugin offers new Endpoints to support formatting the REST search responses.
This plugin provide the request format as belows:
- Array format endpoints:
GET /_search_array
POST /_search_array
GET /{index}/_search_array
POST /{index}/_search_array
GET /{index}/{type}/_search_array
POST /{index}/{type}/_search_array
- Fhir Bundle format endpoints:
GET /_search_fhir_bundle
POST /_search_fhir_bundle
GET /{index}/_search_fhir_bundle
POST /{index}/_search_fhir_bundle
GET /{index}/{type}/_search_fhir_bundle
POST /{index}/{type}/_search_fhir_bundle
-
Software dependencies
-
JAVA (jdk-17.0.1)
-
Maven
-
Elasticsearch (8.8.1)
Download: https://www.elastic.co/downloads/past-releases/elasticsearch-8-8-1
-
-
Installation process
-
Build the compiled version of the Elasticsearch-plugin code, and to create a compiled version of it, run the following command:
$ mvn clean install
-
Install the Elasticsearch-plugin
Make the Elasticsearch (1.iii) directory your current working directory and run the following command:
$ ./cd bin
$ ./elasticsearch-plugin install file:/{path_to_project}/target/releases/rs-result-formatting-plugin-2.0-SNAPSHOT.zip
-
To check that the plugin is installed correctly in the elasticsearch, run the following command:
$ ./elasticsearch-plugin list
-
-
Run ElasticSearch
$ elasticsearch
Note: ES 8.1.0 set enable security as default, if you want to test on your local, you may want to disable security follow steps as below:
- Open ./config/elasticsearch.yml file
- Update setting:
- xpack.security.enabled: false
- xpack.security.enrollment.enabled: false
-
Test the plugin
To check that the plugin is working the way you want, run the Elasticsearch in your machine and run the following URL in the browser or Postman:
-
Array format
The response should be:
[ {
"study": "test study A",
"StudyUID": "1.2.4.5.5252",
"age": "12"
}, {
"study": "test study B",
"StudyUID": "1.2.4.5.212",
"age": "12"
}, {
"study": "test study C",
"StudyUID": "1.2.4.5.23512.23.125.125",
"age": "35"
} ] -
Fhir bundle format
The response should be:
{
"resourceType": "Bundle",
"type": "searchset",
"total": 5,
"entry": [{...}, {...}]
}
-
The original version of this plugin can be reached at: https://github.com/jprante/elasticsearch-arrayformat