Protected _accessProtected _accessProtected _clientProtected Optional _configTrait instance configuration.
Protected _dataProtected _globalWhether this is a global (not bound to any specific schema item) trait instance.
Protected _graphqlProtected _queryProtected _runtimeProtected _schemaProtected _searchProtected Optional _typeTrait type.
Private userStatic Private schemaEnsure that the global schema hooks only run once.
Static Private searchKeep track of the vertex types on which search is enabled.
Static synonymsA flag to enable synonyms functionalities once for both the retrieval and updating of the index.
Static Private unionsKeep track of whether the union schema has been altered yet.
Helper method which initializes/returns SearchTrait storage object.
SearchTraitStorage
Implements alterUnions.
Adds a SearchResultsUnion union with all the possible search result types.
The possible types are gathered when setConfig() is called.
types defined in the trait configuration, and an additional MissingEntity type for notifications that relate to deleted entities.
Note that enabling this trait on multiple schema types is not supported, and doing so will cause the union to be declared multiple times.
Implements autoConfig.
Automatically add and configure relationship definitions for vertex schemas, or conditionally enable the trait for edge schemas, as required to support search-based connections.
Since this pseudo-hook is only called on enabled traits, the "conditionally enable" bit is done by enabling it on the base trait, and conditionally disabling it.
Private buildPrepares values for the access_keys field.
Protected buildProtected buildHelper function for legacy filter search.
Private buildPrepares values for the relationships field (backward compatibility wrapper).
Rest ...__namedParameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]Protected buildPrivate createPrivate deletePrivate deletePrivate extractPrivate getPrivate getExtract only the edge properties that are configured to be indexed.
A name-value record of the properties to be indexed.
The edge object
Protected getHelper function for legacy filter search.
Private getHelper function for legacy filter search.
Rest ...__namedParameters: [query: GraphTraversalAndExpression]Search field resolver.
Attaches Trait callbacks to schema item hooks.
Private indexPrivate indexOptional created: stringPrivate invalidateProtected isChecks if given field is searched with Elasticsearch.
This handles the retrieval of the synonyms for a tenant.
An array of synonym strings
The parent
The user context
Makes this Trait instance global.
Private mapThe postHandleAddRelationship hook implementation, is called when an edge has been added to a vertex. As the edge may change the data we hold in Elasticsearch we need to update the documents accessKeys and relationships fields.
The type of the document vertex or edge
Rest ...param1: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, targetId: string, edge: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]An array of parameters passed to the hook see VertexPostRelationshipUpdateHookCallback
Post-create hook implementation.
Rest ...__namedParameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]Post-delete hook implementation.
Rest ...__namedParameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]The postHandleEntityRelationshipUpdate hook implementation, is called when an edge has been added to / removed from a vertex. As the edge may change the data we hold in OpenSearch we need to update the document's accessKeys and relationships fields.
Vertex or Edge
The trait data
The id of the entity that has been updated
The datasource wrapper
The user context
The postHandleRemoveRelationship hook implementation, is called when an edge has been removed from a vertex. As the edge may change the data we hold in Elasticsearch.
The type of the document vertex or edge
Rest ...parameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, relationshipData: RelationshipData, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]An array of parameters passed to the hook [@see VertexPostRelationshipUpdateHookCallback]
Post-update hook implementation.
Rest ...__namedParameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, item: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]The postUpdateHandleRelationship hook implementation, is called when an edge has been updated. As the edge may change the data we hold in Elasticsearch we need to update the documents accessKeys and relationships fields.
The type of the document vertex or edge
Rest ...param1: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, targetId: string, edge: StoredKosmosItem, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]An array of parameters passed to the hook see VertexPostRelationshipUpdateHookCallback
Pre-delete hook implementation.
Rest ...__namedParameters: [traitData: TraitDataObject<unknown, Record<string, any>, Promise<any>>, uuid: string, datasourceWrapper: DataSourceWrapper, context: KosmosUserContext<object>]This method is triggered when a trait callback has been activated
This is the name of the callback function to call.
References to the Graph Hanlder
Request data passed along as part of the request.
Protected rebuildHelper function for legacy filter search.
Private reindexOptional prefetchedVertices: any[]are not really overriding how config is set; rather, we exploit the fact that this method is called at a particular point during initialisation to keep track of the schemas on which the trait is enabled.
Specifically: it's called after autoConfig, which decides whether the trait will be enabled on this entity type or not; but before alterUnions, which is where we need to use that information.
This handles the update functionality for the synonyms,
Success or failure
The parent
The synonyms to update
The user context
NOT CURRENTLY USED
The package details
The user context
The bucket to store the synonyms file in
The key for the synonyms file
--- NOT CURRENTLY USED --- This function is used to update the synonyms package in OpenSearch, it uses the method of updating the analyser settings for the index.
Once the above steps are completed the synonyms will be updated, however it will be required to re-index the data.
Boolean indicating success or failure
The user context
The synonyms to store
This function is used to update the synonyms file in the S3 bucket.
The user context
The bucket to store the synonyms file in
The key for the synonyms file
The synonyms to store
Private updateUpdates a vertex search document in ES.
Helper method for wrapping legacy Kosmos traits callbacks.
TODO: Remove this method once all Traits are converted.
Optional callbackName: stringOptional callback name; passing this parameter will additionally wrap the callback into legacy process().
Static traitGenerated using TypeDoc
The Elasticsearch integration trait.
Indexes Kosmos contents in Elasticsearch, then hooks into filtering queries for these fields and converts normal Gremlin queries to Neptune-specific fulltext queries.
Requires AWS Neptune and AWS OpenSearch.
Usage:
In config.yml
Mermaid
Content indexing
Mermaid
Search query