Elasticsearch Connector
Starting with 8.1.400.58, ORS enhances its Elasticsearch real-time reporting capabilities. Enhancments include a new Orchestration SCXML extension, elasticconnector. The purpose of elasticconnector SCXML extension is to:
- Remove management of connectivity to Elasticsearch cluster from the SCXML strategy.
- Provide simplified access to Elasticsearch APIs.
elasticconnector Action Elements
ORS supports the following new Action elements that can be used with Composer's SCXML State block:
<createindextemplate>
- Execution of this Action results in a request to Elasticsearch only if the current ORS did not execute such action with the same template name and the same or higher order.
- If the pattern in the “index” attribute matches the “performance” daily index (like “perf*”, “performance-*”, and so on), the action will fail with the appropriate error and error description.
- If the pattern in the “index” attribute matches the “session” daily index and “order” is defined as 0, action will fail with the appropriate error and error description. As a general rule – the template always has order=0 and only one template is created per “session” and “performance” indexes; custom templates always have to have order>0.
[+] createindextemplate
Name
|
Required
|
Type
|
Def. value
|
Valid values
|
Description
|
requestid
|
False
|
Location expression
|
none
|
Any valid location expression, which represents a string.
|
This is the location for the request ID that is returned as
part of this request. Standard attribute of all
Orchestration actions.
|
name
|
True
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
template name
|
index
|
True
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch index name (pattern).
|
order
|
False
|
Value expression
|
0
|
Any value expression that returns a valid integer.
|
Elasticsearch template order.
|
type
|
True
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch type name.
|
mapping
|
True
|
Value expression
|
none
|
Any valid ECMAScript object.
|
Object that represents the whole body of Elasticsearch property
of mappings.type in the mapping request.
|
timeout
|
False
|
Value expression
|
0
|
Any value expression that returns a valid integer.
|
The integer returned must be interpreted as a time interval
in milliseconds. This interval begins when action is executed.
A failed and timed out fetch returns the
error.elasticconnector.createindex event.
|
<createdoc>
Execution of this Action results in an add document request from ORS to Elasticsearch (via the index API).
[+] createdoc
Name
|
Required
|
Type
|
Def. value
|
Valid values
|
Description
|
requestid
|
false
|
Location expression
|
none
|
Any valid location expression which represents a string.
|
This is the location for the request ID that is returned as
part of this request. Standard attribute of all
Orchestration actions.
|
id
|
false
|
Value expression
|
none
|
Any value expression that returns a valid string
|
Elasticsearch document within an index. If not specified, an ID
will be automatically generated. Explicit ID assignment and
automatic ID generation cannot be mixed within same index.
|
index
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch index name
|
type
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch type name
|
request
|
true
|
Value expression
|
none
|
Any valid ECMAScript object
|
Object that represents the whole body of an Elasticsearch create
document API request.
|
bulk
|
false
|
Boolean expression
|
false
|
true,false
|
If true, Elasticsearch request will be just added to the ORS
bulk request buffer and the elasticconnector.createdoc.done
event will be raised immediately. If false, a request to create
document will be sent to Elasticsearch and the
corresponding event and elasticconnector.createdoc.done or
error.elasticconnector.createdoc will be raised after a
response from Elasticsearch.
|
timeout
|
false
|
Value expression
|
0
|
Any value expression that returns a valid integer.
|
The integer returned must be interpreted as a time
interval in milliseconds. This interval begins when
action is executed. A failed and timed out fetch
returns the error.elasticconnector.createdoc event.
|
settings
|
false
|
Value expression
|
none
|
Any valid ECMA script object.
|
Object that represents the body of the Elasticsearch /_settings index API request.
|
The settings attribute has been introduced in version 8.1.400.64. For more information, see ORS Options for Elasticsearch 5.3, Index Settings for Custom Indexes section.
<updatedoc>
Execution of this Action results in an update document request from ORS to Elasticsearch (via update API).
[+] updatedoc
Name
|
Required
|
Type
|
Def. value
|
Valid values
|
Description
|
requestid
|
false
|
Location expression
|
none
|
Any valid location expression which represents a string.
|
This is the location for the request ID that is returned as
part of this request. Standard attribute of all
Orchestration actions.
|
id
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch document ID within an index.
|
index
|
false
|
Value expression
|
Current session daily index.
|
Any value expression that returns a valid string.
|
Elasticsearch index name. If not specified, current session
daily index will be used. Also, in this case, the type attribute
must be not specified, or the action will fail.
|
type
|
false
|
Value expression
|
“session”
|
Any value expression that returns a valid string.
|
Elasticsearch type name. If not specified, the “index”
attribute should be not specified as well and “session”
type will be used.
|
request
|
true
|
Value expression
|
none
|
Any valid ECMAScript object
|
Object that represents the whole body of an Elasticsearch
update document API request.
|
bulk
|
false
|
Boolean expression
|
true
|
true,false
|
If true, Elasticsearch request will be just added to the ORS
bulk request buffer and elasticconnector.updatedoc.done
event will be raised immediately. If false, a request to
update document will be sent to Elasticsearch and
corresponding event elasticconnector.updatedoc.done
or error.elasticconnector.updatedoc will be raised after
response from Elasticsearch.
|
timeout
|
false
|
Value expression
|
0
|
Any value expression that returns a valid integer.
|
The integer returned is interpreted as a time
interval in milliseconds. This interval begins when
the action is executed. A failed and timed out fetch
returns the error.elasticconnector.updatedoc event.
|
settings
|
false
|
Value expression
|
none
|
Any valid ECMA script object.
|
Object that represents the body of the Elasticsearch /_settings index API request.
|
The settings attribute has been introduced in version 8.1.400.64. For more information, see ORS Options for Elasticsearch 5.3, Index Settings for Custom Indexes section.
<deletedoc>
Execution of this Action results in a delete document request from ORS to Elasticsearch (via delete API).
[+] deletedoc
Name
|
Required
|
Type
|
Def. value
|
Valid values
|
Description
|
requestid
|
false
|
Location expression
|
none
|
Any valid location expression which represents a string.
|
This is the location for the request ID that is returned as
part of this request. Standard attribute of all
Orchestration actions.
|
id
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch document ID within an index.
|
index
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch index name
|
type
|
true
|
Value expression
|
none
|
Any value expression that returns a valid string.
|
Elasticsearch type name
|
bulk
|
true
|
Boolean expression
|
true
|
true,false
|
If true, Elasticsearch request will be added to ORS
bulk request buffer and elasticconnector.deletedoc.done
will be raised immediately. If false, request to delete
document will be sent to Elasticsearch and corresponding
elasticconnector.deletedoc.done or
error.elasticconnector.deletedoc event will be raised after
a response from Elasticsearch.
|
timeout
|
false
|
Value expression
|
0
|
Any value expression that returns a valid integer.
|
The integer returned is interpreted as a time
interval in milliseconds. This interval begins when the action is
executed. A failed and timed out fetch returns the
error.elasticconnector.deletedoc event.
|
Events
The following Events are supported:
[+] Events
}
Name
|
Attributes
|
Description
|
elasticconnector.createindextemplate.done
|
|
This event indicates the success of the request.
|
requestid
|
This is the ID of the request.
|
error.elasticconnector. createindextemplate
|
|
This indicates that an error occurred while trying to
perform the createindextemplate request.
|
requestid
|
This is the ID associated with the request.
|
error
|
This is the type of error that occurred. The following is a
specific error code:
protocol.errorcode - This represents the protocol-specific
errors that occur when the attempting the request.
|
description
|
This is a more detailed description of the error
|
elasticconnector.createdoc.done
|
|
This event indicates the success of the request.
|
id
|
This is ID of created document.
|
requestid
|
This is the ID of the request.
|
error.elasticconnector.createdoc
|
|
This indicates that an error occurred while trying to
perform the createdoc request.
|
requestid
|
This is the ID associated with the request.
|
error
|
This is the type of error that occurred. The following is a
specific error code:
protocol.errorcode - This represents the protocol-specific
errors that occur when the attempting the request.
|
description
|
This is a more detailed description of the error
|
elasticconnector.updatedoc.done
|
|
This event indicates the success of the request.
|
Requestid
|
This is the ID of the request.
|
error.elasticconnector.updatedoc
|
|
This indicates that an error occurred while trying to
perform the updatedoc request.
|
Requestid
|
This is the ID associated with the request.
|
Error
|
This is the type of error that occurred. The following is a
specific error code:
protocol.errorcode - This represents the protocol-specific
errors that occur when the attempting the request.
|
Description
|
This is a more detailed description of the error
|
elasticconnector.deletedoc.done
|
|
This event indicates the success of the request.
|
Requestid
|
This is the ID of the request.
|
error.elasticconnector.deletedoc
|
|
This indicates that an error occurred while trying to
perform the deletedoc request.
|
Requestid
|
This is the ID associated with the request.
|
Error
|
This is the type of error that occurred. The following is a
specific error code:
protocol.errorcode - This represents the protocol-specific
errors that occur when the attempting the request.
|
Description
|
This is a more detailed description of the error
|