How to Clean Your Analytics Engine
-
How to Delete An Elasticsearch Index Using the DeleteElasticIndex Tool
-
How to Delete Items From the Elastic Index Using the DeleteByQuery Tool
How to Delete An Elasticsearch Index Using the DeleteElasticIndex Tool
Location of Tool
The tool can be found in the SmartHub installation folder under: ...\Tools\DeleteElasticIndex.
How to Configure the DeleteElasticIndex Tool
You must first configure the tool before using it. Use the following configuration steps:
- Open the BAInsight.PortalAnalytics.DeleteElasticIndex.exe.config file in a text editor:
-
Change the values in the following section:
appSettings values<appSettings>
<add key="ElasticServerAddress" value="http://localhost:9200" />
<!--The address where the Elastic Index can be found; The default value is http://localhost:9200-->
<add key="IndexName" value="paxindex" />
<!--The Elastic Index name you want to delete-->
</appSettings>- ElasticServerAddress (required): Enter the address of your Elastic instance. For example: http://localhost:9200.
- IndexName (required): Enter the name of the Elastic Index that you want to delete.
- For example:
paxindex
.
- For example:
- Save the file and make sure that this file is in the same location as the file BAInsight.PortalAnalytics.DeleteElasticIndex.exe.
How to Run the DeleteElasticIndex Tool
- Right-click the file BAInsight.PortalAnalytics.DeleteElasticIndex.exe and select "Run as administrator."
- After the executable file runs, go to the Elasticsearch index location and confirm that the index was deleted.
- After you run the BAInsight.PortalAnalytics.DeleteElasticIndex.exe, the logs folder with logs file appears in the same location as the .exe and .xml files: ...\Tools\DeleteElasticIndex\Logs.
If you delete the analytics index (default value is paxindex) you need to go to the Analytics Configuration page and re-save the configuration.
How to Delete Items From the Elastic Index Using the DeleteByQuery Tool
You can delete some items from the Elastic index using the DeleteByQuery tool.
Location of Tool
The tool can be found in the SmartHub installation folder under ...\Tools\DeleteByQuery.
How to Configure the DeleteByQuery Tool
You must first conifgure the tool before using it. Use the following instructions to configure the tool.
- Open the BAInsight.PortalAnalytics.DeleteByQuery.exe.config XML file in a text editor.
-
Change the values in the following section:
DeleteByQuery Values to Change<appSettings>
<add key="ElasticServerAddress" value="http://localhost:9200" />
<!-- The address where the Elastic Index can be found; The default value is http://localhost:9200 -->
<add key="IndexName" value="paxindex" />
<!-- The Elastic Index name you want to delete items from -->
<add key="Types" value="" />
<!-- Default Smart Analytics Types (comma separated). Leave this empty to search all types -->
<add key="DeleteByQuery" value="*" />
<!-- Query to delete by from Elastic Index -->
<add key="DeleteSize" value="10000" />
<!-- Max number of items to delete; The tool cannot delete more than 10000 items at one time. If you want to delete more items, you need to run it again. -->
</appSettings>- ElasticServerAddress: Specify the address where the Elastic index can be found.
- IndexName: Specify the name of the Elastic index that you want to delete. For example, enter
paxindex.
- Types
:
- ""(empty): Delete all types.
- Analytics types are separated by commas (
,
). For example,PAXSelection,PAXDocument
.
- ""(empty): Delete all types.
- DeleteByQuery: Specify the query to get the items from Elasticsearch index. The query syntax is Elasticsearch QueryString Query. The matching items are deleted from index.
- DeleteSize: Specify the number of items to delete. The maximum number is
10000
. If you want to delete more items, run the tool again.
- Save the file to the same location as the BAInsight.PortalAnalytics.DeleteByQuery.exe.
How to Run the DeleteByQuery Tool
- Right-click the file BAInsight.PortalAnalytics.DeleteByQuery.exe and select "Run as administrator."
- Wait for the process to complete.
- Go to the Elasticsearch address. Verify the items are deleted.
Use the Logs
After you run the BAInsight.PortalAnalytics.DeleteByQuery.exe, the following folder appears ...\Tools\DeleteByQuery\Logs.
Use the LogConfig.xml file in this folder to edit the query in the BAInsight.PortalAnalytics.DeleteByQuery.exe.config file:
- To delete the results retrieved from querying all use the following code:
<add key="DeleteByQuery" value="all" /> <!-- Query to delete by from Elastic Index →
- To change the maximum file size, change the code <
maximumFileSize value=""/>
as shown in the following example:
Restore access to analytics reports
If your Kibana instance becomes corrupted and you need to restore access to your analytics reports, use the following steps:
-
Identify the name of the Kibana index in ElasticSearch associated with the correct alias:
-
Open your web browser or a tool like Postman and enter the following URL: <elasticsearch_url>/_alias/<alias_name>
-
Replace <elasticsearch_url> with the URL of your ElasticSearch instance.
-
Replace <alias_name> with the appropriate value based on your Kibana version:
-
For Kibana versions 8.7.1 and earlier, use .kibana
-
For Kibana versions 8.8.0 and later, use .kibana_analytics
-
-
Copy the Kibana index name.
-
-
Using the DeleteElasticIndex tool, delete the index with the name you copied in step 1d.
-
Restart the Kibana service to ensure that the changes took effect.
-
After Kibana has restarted, navigate to the Analytics Settings page and save your Kibana configuration to re-establish the reports.