new ElasticsearchQuery()
Represents an elasticsearch query
Extends
Methods
addAggregation(aggregationIdentifier, type, aggregationDefinition) → {object}
Adds an aggregation to the elastic query.
Name | Type | Description |
---|---|---|
aggregationIdentifier | string | |
type | string | |
aggregationDefinition | object |
- Since
- 5.4.0
- Type:
- object
aggregation(aggregationIdentifier) → {object}
Returns the aggregation with the given name
Name | Type | Description |
---|---|---|
aggregationIdentifier | string |
- Since
- 5.4.0
- Type:
- object
definedParameters() → {Array.<$k.QueryParameter>}
Returns the parameters of the query
- Overrides
- Type:
- Array.<$k.QueryParameter>
deregister()
Deregisters the element. The id will be undefined afterwards. Equivalent to setId(undefined)
- Inherited From
- See
- setId
explainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}
Returns elements involved in the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | Elements to explain. Elements that do not match the query are ignored. | |
parameters | object | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
facets() → {Array.<string>}
Returns all facet identifiers contained in the query result
- Since
- 5.5.0
- Type:
- Array.<string>
facetTerms(facetIdentifier) → {Array.<$k.ElasticsearchTerm>}
Returns the corresponding facet terms with doc count
Name | Type | Description |
---|---|---|
facetIdentifier | string |
- Since
- 5.5.0
- Type:
- Array.<$k.ElasticsearchTerm>
filterElements(elements, parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}
Returns all elements that match the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | ||
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
var hits = $k.Registry.query("experts").filterElements(persons);
findElements(parametersopt, searchStringopt) → {Array.<$k.SemanticElement>}
Search and return all found semantic elements
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
var hits = $k.Registry.query("directSearch").findElements("Test");
var hits = $k.Registry.query("compositeSearch").findElements("Test", { context: "portal" });
findHits(parametersopt, searchStringopt) → {Array.<$k.Hit>}
Search and return all found hits.
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.Hit>
var hits = $k.Registry.query("directSearch").findHits("Test*");
findResultSize(parametersopt, searchStringopt) → {number}
Search and return the number of found semantic elements
Name | Type | Attributes | Description |
---|---|---|---|
parameters | object | <optional> | |
searchString | string | <optional> |
- Since
- 5.3.3
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- number
fullExplainElements(elements, parametersopt) → {Array.<$k.SemanticElement>}
Returns all elements involved in the query
Name | Type | Attributes | Description |
---|---|---|---|
elements | Array.<$k.SemanticElement> | Elements to full explain. Elements that do not match the query are ignored. | |
parameters | object | <optional> |
- Overrides
When the query could not be solved, e.g. missing parameters
- Type:
- Array.<$k.SemanticElement>
id() → {string}
Returns the registered ID, or undefined if not registered.
- Inherited From
- Type:
- string
name() → {string}
Returns the name
- Overrides
- Type:
- string
paginate(startIndex, pageSize)
Sets the pagination of the query
Name | Type | Description |
---|---|---|
startIndex | integer | start index |
pageSize | integer | size of the page |
- Since
- 5.4.2
parentFolders() → {Array.<$k.Folder>}
Returns the folders that contain this element
- Inherited From
- Type:
- Array.<$k.Folder>
registryType() → {string}
Returns the name of the registry that contains elements of this type
- Inherited From
- Type:
- string
renderElements(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}
Search and render found semantic elements using the given table configuration
Name | Type | Attributes | Description |
---|---|---|---|
tableConfiguration | $k.TableConfiguration | ||
keyFilter | object | <optional> | Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters(). |
detailFilter | object | <optional> | Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail() |
- Since
- 4.1.0
- Overrides
- Deprecated
- This function is deprecated and might be removed in future releases
When the query could not be solved, e.g. missing parameters
The rendered objects
- Type:
- Array.<object>
renderHits(tableConfiguration, keyFilteropt, detailFilteropt) → {Array.<object>}
Search and render found hits using the given table configuration
Name | Type | Attributes | Description |
---|---|---|---|
tableConfiguration | $k.TableConfiguration | ||
keyFilter | object | <optional> | Alternative 1 (preferred): a $k.JSONRenderContext Alternative 2 (compatibility only): A filter. See $k.JSONRenderContext.prototype.setFilters(). |
detailFilter | object | <optional> | Only used if the key filter is not a $k.JSONRenderContext. See $k.JSONRenderContext.prototype.setLevelsOfDetail() |
- Since
- 4.1.0
- Overrides
- Deprecated
- This function is deprecated and might be removed in future releases
When the query could not be solved, e.g. missing parameters
The rendered objects
- Type:
- Array.<object>
resetResult() → {object}
Resets the query result such that the query can be executed again, for example for getting the actual result after fetching the result size.
- Since
- 5.4.0
- Type:
- object
searchString() → {string}
Returns the search string
- Overrides
- Type:
- string
setDomain(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains | $k.Domain | The domain or internal name of a type |
- Since
- 4.1.0
- Overrides
setDomains(domains)
Restrict the query results to objects/types of the domains
Name | Type | Description |
---|---|---|
domains | Array.<$k.Domain> | The domains or internal names of types |
- Overrides
setFacetFilters(facetFiltersArray)
Set the selected facets and terms for the query
Name | Type | Description |
---|---|---|
facetFiltersArray | array | Array with selected facets and terms |
- Since
- 5.1.3
- Overrides
setFacetTerms(facetId, terms)
Set the facet terms of the query.
Name | Type | Description |
---|---|---|
facetId | string | The ID of the facet |
terms | The terms to be activated for filtering. |
- Since
- 5.5.0
When the terms are not suitable for the facet
setId(id, replaceScriptReferences)
Registers the element with the given ID. If the element has already been registered, then the id changes. If the id is undefined, then the element will be deregistered.
Name | Type | Description |
---|---|---|
id | string | The ID |
replaceScriptReferences | boolean | True if ID references in scripts should be replaced. Only done when the old and the new ID is not undefined. |
- Inherited From
setName(name)
Sets the name of the query
Name | Type | Description |
---|---|---|
name | string | The name |
- Version
- Experimental feature, might be removed at any time
- Since
- 5.3.2
- Overrides
setParameter(parameterId, value)
Set a parameter of the query.
Name | Type | Description |
---|---|---|
parameterId | string | The ID of the parameter |
value | The value of the parameter. The type (string etc.) depends on the parameter. Arrays of values can be passed, too. The value undefined or null disables the parametrized condition. |
- Overrides
When the value is not suitable for the parameter
setParameters(parameters)
Set the parameters of the query from the properties of the object
Name | Type | Description |
---|---|---|
parameters | The parameters |
- Overrides
When a value is not a suitable parameter
setSearchString(searchString)
Set the string to search for
Name | Type | Description |
---|---|---|
searchString | string |
- Overrides