The following information applies to the Relativity release 9.5.196.102. For earlier versions of the Index Manager API, see the Relativity 9.4 developer documentation.

Build Analytics indexes

Relativity Analytics are enabled by analytics indexes. Analytics indexes define spatial relationships between documents and concepts measured by their distance in a multi-dimensional space. For background information about Relativity Analytics indexes, see the Relativity Documentation site.

You can automate the creation of Analytics indexes using the IIndexManager .NET interface . You can also use the Index Manager REST service for cross-platform and browser-based applications. For more information, see Build analytics indexes with REST.

After you build the index, you can use it in analytics searches through the Relativity UI or the API. For more information, see Analytics Search Manager API.

This page contains the following information:

See these related pages:

Before you begin

Completed the following prerequisites to begin development with the Analytics Index API:

Analytics index fundamentals

Before programmatically interacting with analytics indexes, familiarize yourself with the Relativity user interface and documentation. Note there is a strong correlation between the API operations and object properties and the user interface elements. You must also ensure that your Relativity credentials have the necessary permissions to the Analytics objects.

To provide your users with an analytics index:

  • Create the index.
  • Submit the index job to populate and build the index.

Note that you can also submit a job to incrementally update an existing index. There are different steps required to build a new index versus incrementally updating an existing index, corresponding to the Analytics Index console buttons in the Relation UI and the values defined by the AnalyticsIndexJobType enumeration.

Beginning in December 2017, we have added support for SVM-based indexes that enable categorization. Because of that, there is now an additional IndexTypeIdentifier property on Analytics Index objects indicating the index type: Conceptual (LSI-based) or Classification (SVM-based). Already existing objects use the Conceptual index type by default. Note that currently you can use SVM-based indexes only with the Active Learning application.

Build a new index

  1. Populate index – add all documents from the training set and searchable set to the ready-to-index list.
  2. Build index – build the concept space.
  3. Activate – make the index available for users. Specifically, it adds the index to the search drop-down on the Documents tab and to the right-click menu in the viewer.

Incrementally update an index

  1. Populate index (incremental) – check the data sources for both the training set and the searchable set. If there are any new documents in either search, it adds them to the index. At this stage, the Analytics index can be queried against.
  2. Deactivate index – disable the index so that it cannot be queried against or used for any analytics operations. The index must be deactivated to perform a build.
  3. Build index – build the concept space. If any training documents have been added, this step will take longer as the engine rebuilds the concept space. If only searchable documents have been added, the engine starts this build at a later step (updating searchable items) as it just needs to map the new searchable documents into the pre-existing concept space.
  4. Activate – make the index available to users.

Index status and job validation

When performing operations on an Analytics index, for example, submitting an index job, the operation must be applicable to the current state of the index. The states of an Analytics index are:

  • Activating
  • Activation Recommended
  • Active
  • Attempting to cancel population
  • Build Recommended
  • Building
  • Configuring Analytics Engine
  • Constructing Population Table
  • Content Analyst Server is unavailable
  • Deactivating
  • Disable queries to continue
  • Disabling Queries
  • Enabling Queries
  • Failed to activate index
  • Failed to deactivate index
  • Finalizing build
  • Index Build Failed
  • Indexing Job in Queue
  • New
  • Not enough conceptual content to build
  • Please check your training set
  • Populating
  • Populating Documents
  • Population Cancelled by User
  • Population Failed
  • Preparing to build
  • Removing Documents in Error
  • Waiting

Note that some of these states overlap with each other and others have various sub-states depending on additional index metadata. For example, many states include an error state like “STATE – 1 or more documents in error status,” where STATE is Populating, Building, etc. There are various error scenarios, for example, when items linked to the index (saved searches, analytics profile) can't be accessed. Regardless of any additional error state, the validator just treats it as "Error" and subsequently only lets you run the two error resolution-type jobs - RetryErrors or RemoveDocumentsInError.

The message state values are returned as the StatusText property of the AnalyticsIndexStatus object.

Key objects

Use the objects in the Analytics.Conceptual.DataContracts and Analytics.Conceptual.Service.Interfaces namespace to interact with analytics indexes. For complete information about the namespaces, classes, methods, properties, and other members of the Services API, see Services API.

AnalyticsIndex

The class represents the Analytics index when creating, reading, and updating indexes. Properties include:

  • Active – Indicates whether or not the search provider associated with the index has been activated
  • AnalyticsServer – the analytics server to be used to build the index. The value is a ResourceServerRef object.
  • ArtifactID – The Artifact ID of the Artifact.
  • ConceptStopWords – the words to suppress from the index. You can add or remove stop words from the list. Separate each word with a hard return. The default values are derived from the [EDDSDBO].[ContentAnalystDefaultNoiseWords] table.
  • ContinueIndexStepsToCompletion – automatically complete all necessary step to activate an Analytics Index after starting a step. For example, if you set the property to True, and submit a populate job, the index will automatically be built and activated. If you don't have it set, only the population will occur, and building and activating must be to be done manually.
  • Dimensions - the number of dimensions of the concept space into which documents are mapped when the index is built. More dimensions increase the conceptual values applied to documents and refine the relationships between documents.
  • EmailNotificationRecipients – the list of emails recipients to be notified during index population and build.
  • EnableEmailHeaderFilter – remove common header fields (such as To, From, and Date) and reply-indicator lines, but it don't remove content from the Subject line. Use this filter to ensure that the headers in the concept space don't overshadow the authored content. Defaults to false.
  • Guids – The GUIDs .
  • IndexTypeIdentifier – the type of index, Conceptual (LSI-based) or Classification (SVM-based). You can set the values using the IndexType enumeration.
  • IndexLastUsedOn – the time this index was last used.
  • LastErrorMessage – the last error message to occur on the index.
  • Name – The friendly name of the index.
  • OptimizeTrainingSet – select only conceptually relevant documents from the training set saved search. For example, documents that are very large, very small, or have a lot of numbers are automatically excluded from training in order to improve index quality. Defaults to false.
  • Order – Order in which index appears in dropdowns. Defaults to 0.
  • RemoveDocumentsThatErroredDuringPopulation – remove documents from being populated that have errored in a previous population.
  • RemoveEnglishSignaturesAndFooters – remove signatures and footers in English language emails from the text stored in the Analytics index. By default, this is set to Yes for new indexes and No for existing ones. Setting this to Yes enables the email header filter, disables the Go Words and OCR filters, and removes documents greater than 30 MB from the searchable set. Defaults to false.
  • RepeatedContentFilters – repeated content filters associated with the index.
  • TrainingSet – the saved search to populate the training set. The value is a SavedSearchRef object.
  • SearchableSet – the saved search to populate the searchable set. The value is a SavedSearchRef object.
  • Note: For both TrainingSet and SearchableSet, the Artifact ID value of the SavedSearchRef object can be set to 0 to use the built-in search for all documents in a workspace, or -1 for default training set/default searchable. Setting the values to 0 can have a negative impact on system performance.

IIndexManager interface

The IIndexManager interface contains the methods for performing index operations:

Tokens for progress and cancellation are not supported with these asynchronous operations. This is also true for the Index Manager REST service operations.

AnalyticsIndexJobType enumeration

The enum defines the valid index job types.

  • FullPopulation (0) – run a full index population.
  • IncrementalPopulation (1) – run an incremental population. This will add or remove documents from the training/searchable sets. Also, while the index will be active after incremental population (as long as it was active before you started incremental population), you won't be able to query the new documents unless you rebuild and reactive.
  • RemoveDocumentsInError (3) – remove documents in error.
  • BuildIndex (4) – run a full index build.
  • Activate (5) – activate the index for querying.
  • Deactivate(6) – disable queries on the index.

Note that these values directly correspond to the buttons on the Analytics Index console in the Relativity UI.

Analytics Index console in the Relativity UI

You can use the ConsoleButtons property of the AnalyticsIndexStatus object to determine if you can run a specific job step for an index. For example, before populating an index, you can check the status and examine Enabled property of the "Populate Index: Full" item in the returned collection. If the value is True, you can submit a population job. If the value is False, the HelpText property explains why the job step can't be run.

AnalyticsIndexStatus

The class represents of the aggregate state of an Analytics index. The status object is returned by the GetStatusAsync operation. Properties include:

  • Active – Indicates if the index is active and able to be queried.
  • ConsoleButtons – list of console buttons and links with their current states. The states can be used to determine what job steps can be run for the index. For more information, see AnalyticsIndexJobType enumeration
  • CurrentStep – the current job step, if a multi-step job is in progress.
  • DocLevelErrorsExist – indicates if there are documents in error in the training set.
  • LastErrorMessage – the last error that occurred on this index
  • OverallTimeElapsed – the total time of the current job, if there is one.
  • PercentageComplete – the completed percentage of the current job step, if it has one.
  • PercentDenominator – the denominator value to generate the percentage of the current job step, if there is one.
  • PercentNumerator – the numerator value to generate the percentage of the current job step, if there is one.
  • SearchableSetCount – the count of items in the searchable set if the index is new or active in its final state.
  • SecondaryPercentageComplete – the completed percentage of a stage of a job step, if it has one.
  • SecondaryStatusText – additional status text.
  • StatusText – the main status text of the index. For more information, see Index status and job validation.
  • StepTimeElapsed – the elapsed time of the current job step, if there is one.
  • TotalSteps – the total number of job steps, if a multi step job is in progress.
  • TrainingSetCount – the count of items in the training set if the index is new or active in its final state.

ArtifactRef

The ArtifactRef class is used to represent the Relativity artifacts referenced by an Analytics index properties, such as repeated content filters, searchable sets, and training sets. Properties include:

  • ArtifactID – The Artifact ID of the artifact.
  • Guids – The GUIDs of the artifact.

IndexType enumeration

The enum defines the valid index types for the IndexTypeIdentifier property on new AnalyticsIndex objects:

  • Conceptual (0) – LSI-based index. This is the default index type.
  • Classification (1) – SVM-based index that supports categorization.

Exceptions

The public exceptions for the Analytics Index Manager API are included in the Analytics.Conceptual.DataContracts.Exception namespace.

  • DeletionDependencyException – An exception representing the case where an object deletion fails because it is referenced by dependencies, for example when attempting to delete an Analytics index that is being used.
  • NotFoundException – An exception representing the case where an item is not available or does not exist, for example, when reading or deleting an Analytics index.
  • PermissionException – An exception representing the case where the user does not have permission to perform an attempted action, for example access a workspace, a searchable or training set, or perform index operations.
  • ValidationException – An exception representing the case where an invalid or malformed request is made, for example, an invalid value is specified for an index property.

Create an index

To create an Analytics index:

  1. Like other Services API interfaces, you start by accessing the IIndexManager interface through a client proxy to the Services API and instantiating an IndexManager object. How you build the client proxy depends on how you plan to use it. If you plan to use it in a custom page, event handler, or agent, you can use API Helpers.

    Otherwise, you can instantiate the IndexManager object using the ServiceFactory class:

    For more information about creating proxies, see Connect to the Services API.

  2. Initialize and populate the index object. Required properties include:
    • AnalyticsServer – the analytics server to be used to build the index. The value is a ResourceServerRef object.
    • Name – The friendly name of the index.
    • Order – Order in which index appears in dropdowns. Defaults to 0.
    • SearchableSet – the saved search to populate the searchable set. The value is a SavedSearchRef object.
  3. Call the CreateAsync method and pass it the workspace Artifact ID and the index object.
  4. Catch PermissionException, ValidationException, and the generic .NET Exception.

    If the operation succeeds, it returns the Artifact ID of the created index. You can use the Artifact ID value to submit the index to be populated and built.

    public async Task CreateAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int searchableSetSearchArtifactID = 1038051;
            int trainingSetSearchArtifactID = 1038051;
            int analyticsServerArtifactID = 1016891;
    
            AnalyticsIndex indexToCreate = new AnalyticsIndex
            {
                Name = "my new analytics index",
                Order = 1,
                SearchableSet = new ArtifactRef { ArtifactID = searchableSetSearchArtifactID },
                TrainingSet = new ArtifactRef { ArtifactID = trainingSetSearchArtifactID },
                AnalyticsServer = new ArtifactRef { ArtifactID = analyticsServerArtifactID },
                OptimizeTrainingSet = true,
                RemoveDocumentsThatErroredDuringPopulation = true,
                ContinueIndexStepsToCompletion = true,
                ConceptStopWords = "a\r\nable\r\nabout\r\nabove\r\naccording\r\n",
                Dimensions = 100,
                RemoveEnglishSignaturesAndFooters = true,
                EnableEmailHeaderFilter = true
            };
    
            try
            {
                int analyticsIndexID = await indexManager.CreateAsync(workspaceId, indexToCreate);
                Debug.WriteLine("ID of the newly created analytics index is: " + analyticsIndexID);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "Failed to create index because of invalid permission. workspaceID: {workspaceId} - IndexToCreate: {@index}",
                workspaceId, indexToCreate);
                throw;
            }
            catch (ValidationException ex)
            {
                // Logging ValidationException
                _logger.LogError(ex,
                "The index you were trying to create was invalid. workspaceID: {workspaceId} - IndexToCreate: {@index}",
                workspaceId, indexToCreate);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Creating index failed. workspaceID: {workspaceId} - IndexToCreate: {@index}",
                workspaceId);
                throw;
            }
        }
    }

Read an index

To read an index after you create it:

  1. Determine the Artifact ID of the index to be read. Use the Relativity Object Query API to programmatically return the Analytics index Artifact ID if you don't already have it. For more information, see Legacy Object Query Manager API.
  2. Get an instance of the IIndexManager interface as described in the previous sections.
  3. Call the ReadAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    The operation returns an Analytics index object. You can use the object to examine the index properties before submitting an index job, or to update or delete the index.

    public async Task ReadSingleAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1049079;
    
            try
            {
                AnalyticsIndex analyticsIndex = await indexManager.ReadAsync(workspaceId, existingIndexArtifactID);
    
                Debug.WriteLine("The name of the retrieved analytics index is " + analyticsIndex.Name);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "You don't have permission to retrieve the index. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (NotFoundException ex)
            {
                // Logging NotFoundException
                _logger.LogError(ex,
                "Failed to retrieve the index because index could not be found. WorkspaceID: {workspaceID} - IndexID: {IndexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Failed to retrieve the index. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }

Update an index

You can update the following properties of an Analytics index object:

  • AnalyticsServer – the analytics server to be used to build the index. The value is a ResourceServerRef object.
  • ConceptStopWords – the words to suppress from the index. You can add or remove stop words from the list. Separate each word with a hard return. The default values are derived from the [EDDSDBO].[ContentAnalystDefaultNoiseWords] table.
  • ContinueIndexStepsToCompletion – automatically complete all necessary step to activate an Analytics Index after starting a step.
  • Dimensions - the number of dimensions of the concept space into which documents are mapped when the index is built. More dimensions increase the conceptual values applied to documents and refine the relationships between documents.
  • EmailNotificationRecipients – the list of emails recipients to be notified during index population and build.
  • EnableEmailHeaderFilter – remove common header fields (such as To, From, and Date) and reply-indicator lines, but it don't remove content from the Subject line. Use this filter to ensure that the headers in the concept space don't overshadow the authored content. Defaults to false.
  • Name – The friendly name of the index.
  • OptimizeTrainingSet – select only conceptually relevant documents from the training set saved search. For example, documents that are very large, very small, or have a lot of numbers are automatically excluded from training in order to improve index quality. Defaults to false.
  • Order – Order in which index appears in dropdowns. Defaults to 0.
  • RemoveDocumentsThatErroredDuringPopulation – remove documents from being populated that have errored in a previous population.
  • RemoveEnglishSignaturesAndFooters – remove signatures and footers in English language emails from the text stored in the Analytics index. By default, this is set to Yes for new indexes and No for existing ones. Setting this to Yes enables the email header filter, disables the Go Words and OCR filters, and removes documents greater than 30 MB from the searchable set. Defaults to false.
  • RepeatedContentFilters – repeated content filters associated with the index.
  • TrainingSet – the saved search to populate the training set. The value is a SavedSearchRef object.
  • SearchableSet – the saved search to populate the searchable set. The value is a SavedSearchRef object.

To update an Analytics index:

  1. Get an instance of the IIndexManager interface as described in the previous sections.
  2. Define the Artifact IDs of the workspace and the exiting index Analytics index to be updated.
  3. Read the index into an AnalyticsIndex object using the ReadAsync() method of the IIndexManager interface.
  4. Update the properties of the index object.
  5. Call the UpdateAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    public async Task UpdateAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1049079;
    
            AnalyticsIndex analyticsIndex = null;
    
            try
            {
                try
                {
                    analyticsIndex = await indexManager.ReadAsync(workspaceId, existingIndexArtifactID);
                }
                catch (PermissionException ex)
                {
                    // Logging PermissionException
                    _logger.LogError(ex,
                    "You don't have permission to read the index. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                    workspaceId, existingIndexArtifactID, userName);
                    throw;
                }
                catch (NotFoundException ex)
                {
                    // Logging NotFoundException
                    _logger.LogError(ex,
                    "Failed to read the index because index could not be found. WorkspaceID: {workspaceID} - IndexID: {IndexId}",
                    workspaceId, existingIndexArtifactID);
                    throw;
                }
                analyticsIndex.Name = "My Updated Analytics Index";
                await indexManager.UpdateAsync(workspaceId, existingIndexArtifactID, analyticsIndex);
    
                analyticsIndex = await indexManager.ReadAsync(workspaceId, existingIndexArtifactID);
    
                Debug.WriteLine("The updated name of the retrieved analytics index is " + analyticsIndex.Name);
    
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "You don't have permission to update the index. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (ValidationException ex)
            {
                // Logging ValidationException
                _logger.LogError(ex,
                "The index you were trying to update has invalid data. workspaceID: {workspaceId} - IndexToUpdate: {@index}",
                workspaceId, analyticsIndex);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Failed to update the index. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }

Get index status

To get the status of an Analytics index:

  1. Get an instance of the IIndexManager interface as described in the previous sections.
  2. Define the Artifact IDs of the workspace and the exiting index Analytics index.
  3. Call the GetStatusAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    The operation returns the AnalyticsIndexStatus object. You can examine the object properties to determine what operations can be performed on the index, for example, whether the index can be populated and built.

    public async Task GetStatusAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1049072;
    
            try
            {
                AnalyticsIndexStatus status = await indexManager.GetStatusAsync(workspaceId, existingIndexArtifactID);
                Debug.WriteLine("Status of the index is " + status.StatusText);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "You don't have permission to get the index states. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (NotFoundException ex)
            {
                // Logging NotFoundException
                _logger.LogError(ex,
                "Couldn't get the index status because index could not be found. WorkspaceID: {workspaceID} - IndexID: {IndexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Failed to get the index status. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }

Submit an index job

To submit an index job after you create the index:

  1. Get an instance of the IIndexManager interface as described in the previous sections.
  2. Define the Artifact IDs of the workspace and the exiting index Analytics index to be updated.
  3. Call the SubmitJobAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs and the Analytics index job type.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    After the index job is submitted, you can use the GetStatusAsync() method to return the status of the job.

    public async Task SubmitJobAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1054087;
    
            try
            {
                await indexManager.SubmitJobAsync(workspaceId, existingIndexArtifactID, AnalyticsIndexJobType.FullPopulation);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "You don't have permission to submit the index. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Failed to submit the index. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }

Cancel an index job

To cancel an index job:

  1. Get an instance of the IIndexManager interface as described in the previous sections.
  2. Define the Artifact IDs of the workspace and the exiting index Analytics index to be updated.
  3. Call the CancelJobAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    public async Task CancelJobAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1054087;
    
            try
            {
                await indexManager.CancelJobAsync(workspaceId, existingIndexArtifactID);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "Cancelling job failed because of invalid permission. WorkspaceID {workspaceID} - IndexID {indexID} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (NotFoundException ex)
            {
                // Logging NotFoundException
                _logger.LogError(ex,
                "Cancelling Job failed because index could not be found. WorkspaceID {workspaceID} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Cancelling Job failed. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }

Delete an index

To delete an index:

  1. Get an instance of the IIndexManager interface as described in the previous section.
  2. Define the Artifact IDs of the workspace and the exiting index Analytics index to be updated.
  3. Call the DeleteAsync() method of the IIndexManager interface and specify the workspace and the index Artifact IDs.

    Catch PermissionException, ValidationException, and the generic .NET Exception.

    public async Task DeleteAsyncSampleCode()
    {
        string userName = "user@test.com";
        string password = "Test1234!";
    
        string relativityServicesUri = "http://localhost/relativity.services";
        string relativityRestUri = "http://localhost/relativity.rest/api";
    
        var usernamePasswordCredentials = new UsernamePasswordCredentials(userName, password);
        ServiceFactorySettings settings = new ServiceFactorySettings(new Uri(relativityServicesUri), new Uri(relativityRestUri), usernamePasswordCredentials);
        ServiceFactory serviceFactory = new ServiceFactory(settings);
    
        using (IIndexManager indexManager = serviceFactory.CreateProxy<IIndexManager>())
        {
            int workspaceId = 1023289;
            int existingIndexArtifactID = 1054085;
    
            try
            {
                await indexManager.DeleteAsync(workspaceId, existingIndexArtifactID);
            }
            catch (PermissionException ex)
            {
                // Logging PermissionException
                _logger.LogError(ex,
                "Deleting Index failed because of invalid permission. WorkspaceID {workspaceId} - IndexID {IndexId} - username: {username}",
                workspaceId, existingIndexArtifactID, userName);
                throw;
            }
            catch (NotFoundException ex)
            {
                // Logging NotFoundException
                _logger.LogError(ex,
                "Deleting Index failed because index could not be found. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
            catch (DeletionDependencyException ex)
            {
                // Logging DeletionDependencyException
                _logger.LogError(ex,
                "Deleting Index failed because there is a dependecy on it. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
            catch (Exception ex)
            {
                // Logging General Exceptions
                _logger.LogError(ex,
                "Deleting index failed. WorkspaceID {workspaceId} - IndexID {indexId}",
                workspaceId, existingIndexArtifactID);
                throw;
            }
        }
    }