Managing the OpenSearch index for Connections type-ahead search
The Connections type-ahead search feature uses an index named “quickresults” within the OpenSearch search engine. Review the following information about this index, preferably before creating the quickresults index and enabling the type-ahead search capability.
Shard number
The default number of shards for this index is eight. If you want to change this default, do so before the index is created, because the new value applies only to future indexes and does not affect existing indexes. Changing the number of shards after the type-ahead Search component is enabled and deployed requires you to create a new index, or to follow a series of manual steps. Additional shards in an OpenSearch index consume resources and can affect performance depending on how the shards are used. Change the default setting only when you have carefully weighed the advantages and disadvantages of doing so in your environment. You can refer to following guide for details on changing the default shard number for future indexes: Changing the number of shards for the OpenSearch Quickresults index.
Changing the number of shards for the OpenSearch quickresults index
By default, the quickresults index shard count is set to 8. To modify this value, follow these steps:
- No index created
- Existing index
- Setup
No index created
If you have not yet created the quickresults index, or if you are going to delete the old index and start over with a new clean index, follow these steps:
-
Update the search-config.xml file in the Deployment Manager profile configuration folder:
Add the following statements to
<property name=”quickResults”>
section, replacing the value with the desired number of replicas.<propertyField name=quick.results.elasticsearch.shards.count' value='8'/>
-
Synchronize the nodes and then restart the servers or clusters that are running the Search and Common applications.
- Create (or recreate) the index, refer to Set up Metrics for OpenSearch.
Existing index
If you already have a quickresults index with data from your Connections users, it requires planning and additional steps to modify the number of shards in use. Use the following guide to reduce the number of shards in the quickresults index.
The strategy for reducing the shards will be to use the OpenSearch Shrink Index API, which will create a new index with a reduced shard count. Once this is completed, an OpenSearch alias will be added to the index so that Connections can still access it using the name “quickresults”.
Setup
These steps are based on the OpenSearch Shrink Index documentation. The CURL tool is used to submit API requests to the OpenSearch engine and it will typically require access to the certificates that were used when setting up OpenSearch for the Metrics component. For information on how to retrieve the p12 certificate, refer to Steps to install or upgrade to Component Pack 8 CR2. The exact curl syntax may vary based on which OS is used, however the following example could be used to connect to an OpenSearch server which is using a self-signed certificate.
curl -k --cert-type P12 --cert opensearch-metrics.p12:password -X GET "https://esserver.example.com:30099/quickresults?pretty"
- Shut down the Connections Search enterprise application using the WebSphere administration console. This will prevent the Connections apps from attempting to update the index while Connections is running.
-
Mark the current index as read-only and force a copy of every shard in the index to the same node and have green health.
Next, execute into opensearch-client pod:
kubectl exec -ti -n connections $(kubectl get pods -n connections -o wide | grep opensearch-cluster-client | awk '{print $1}' | head -n 1) -- bash
Run the following command for shrink operation:
/usr/share/opensearch/probe/sendRequest.sh PUT "/quickresults/_settings?pretty" -H 'Content-Type: application/json' -d' { "settings": { "index.routing.allocation.require._name": "shrink_node_name", "index.blocks.write": true } } '
-
Monitor this operation using the cluster health API for the quickresults index.
/usr/share/opensearch/probe/sendRequest.sh GET "/_cluster/health/quickresults?wait_for_no_relocating_shards=true&pretty"
Wait until this returns a value for
relocating_shards= 0
. -
Set the desired number of shards and replicas and shrink the index. The number_of_shards must be a factor of the number of shards in the source index. For example, if the original shards is 8, the number can be 4, 2 or 1.
/usr/share/opensearch/probe/sendRequest.sh POST "/quickresults/_shrink/quickresults_shrink?pretty" -H 'Content-Type:application/json' -d'.
{ "settings": { "index.number_of_replicas": 1, "index.number_of_shards": 2 } } '
-
Monitor this operation using the cluster health API for the quickresults_shrink index.
/usr/share/opensearch/probe/sendRequest.sh GET "/_cluster/health/quickresults_shrink?wait_for_active_shards=1&pretty"
Wait until this returns a value for
active_shards=1
. -
Delete the old quickresults index using this command:
/usr/share/opensearch/probe/sendRequest.sh DELETE "/quickresults"
-
Assign an alias called “quickresults” to the new index quickresults_shrink using this command:
/usr/share/opensearch/probe/sendRequest.sh POST "/_aliases?pretty" -H 'Content-Type:application/json' -d' { "actions" : [ { "add" : { "index" : "quickresults_shrink", "alias" : "quickresults" } } ] } '
-
Verify the new indexes exist with the expected shard and replica counts.
/usr/share/opensearch/probe/sendRequest.sh GET "/quickresults?pretty"
-
Restart the application.
Parent topic:Setting up type-ahead search