new ElasticModel()
modules/core/elasticsearch.js, line 10
This model ist the central functionality to send and receive requests from elastic indices.
It is called by several other tools such as the gdi search or the elastic search.
Extends
Methods
-
abortXhrRequestByServiceId(xhrRequests, serviceId){Object}
modules/core/elasticsearch.js, line 57 -
Aborts the running request by given serviceId and deletes it from the object.
Name Type Description xhrRequestsObject all xhr requests that are currently running. serviceIdString Id of rest-service. Returns:
All xhr requests that have not be cancelled.
-
findAttributeByPath(object, path){*}
modules/core/elasticsearch.js, line 146 -
Returns the attribute value of the given object by path. If path is an array, the function recursively iterates over the object for each part and pushes the value in an array. Otherwise only the value of the given attribute path will be returned.
Name Type Description objectObject Object to derive value from. pathString | Array.<String> Path of the attribute. "." in the path indicates the next deeper level. Returns:
Value that is at position of given path.
-
parseResponse(event, responseEntryPath, result){Object}
modules/core/elasticsearch.js, line 118 -
Parses the response event.
Name Type Description eventEvent Event of xhrRequest. responseEntryPathString The path of the hits in the response JSON. The different levels of the response JSON are marked with "." resultObject Result object. Name Type Description statusString Status of request "success" or "error". messageString Message of request. hitsArray.<Object> Array of result hits. Returns:
Parsed result of request.
-
search(xhrConfig){Object}
modules/core/elasticsearch.js, line 24 -
Main function to start the search using the xhrConfig.
Name Type Description xhrConfigObject The configuration of the xhr request. Name Type Default Description serviceIdString Id of the rest-service to be used. If serviceId is give, the url from the rest-service is taken. urlString If no serviceId is given, alternatively an url can be passed. typeString Type of request. "POST" or "GET". payloadObject Payload used to "POST" to url or be appended to url if type is "GET". asyncBoolean Flag if request should be sent asynchronously. responseEntryPathString "" The path of the hits in the response JSON. The different levels of the response JSON are marked with "." Returns:
The result object of the request.
-
setXhrRequests(value){void}
modules/core/elasticsearch.js, line 170 -
Setter for attribute "xhrRequests"
Name Type Description valueObject xhr requests. -
xhrSend(serviceId, url, xhrConfig, result){Object}
modules/core/elasticsearch.js, line 77 -
Sends the request
Name Type Description serviceIdString Id of rest-service. urlString url to send request. xhrConfigObject Config with all necccessary params for request. resultObject Result object. Name Type Description statusString Status of request "success" or "error". messageString Message of request. hitsArray.<Object> Array of result hits. Returns:
Parsed result of request.