Skip to content

WIP: #1141 Set Up Basic SearchClient#1021

Draft
demariadaniel wants to merge 7 commits intomainfrom
1141/feat-setup-opensearch-client
Draft

WIP: #1141 Set Up Basic SearchClient#1021
demariadaniel wants to merge 7 commits intomainfrom
1141/feat-setup-opensearch-client

Conversation

@demariadaniel
Copy link
Contributor

@demariadaniel demariadaniel commented Jan 29, 2026

Summary

Base feature branch for supporting multiple Search client options in Arranger

Issues

Description of Changes

  • Creates a shared SearchClient function for determining configuration and returning appropriate client
  • Adds OpenSearch client library
  • Initial Type structure for SearchClient
  • Prettier & Typescript cleanup across multiple files

Setup

  • Requires Arranger npm install:
cd /arranger
npm i

Successful connection to Arranger server with both OpenSearch and Elastic setups:

OpenSearch:
Screenshot 2026-02-11 at 2 40 03 PM

ElasticSearch:
Screenshot 2026-02-11 at 3 13 08 PM

Readiness Checklist

  • Self Review
    • I have performed a self review of code
    • I have run the application locally and manually tested the feature
    • I have checked all updates to correct typos and misspellings
  • Formatting
    • Code follows the project style guide
    • Autmated code formatters (ie. Prettier) have been run
  • Local Testing
    • Successfully built all packages locally
    • Successfully ran all test suites, all unit and integration tests pass
  • Updated Tests
    • Unit and integration tests have been added that describe the bug that was fixed or the features that were added
  • Documentation
    • All new environment variables added to .env.schema file and documented in the README
    • All changes to server HTTP endpoints have open-api documentation
    • All new functions exported from their module have TSDoc comment documentation

@demariadaniel demariadaniel changed the title WIP: Basic SearchClient, w/ some type & import cleanup WIP: Basic SearchClient Jan 30, 2026
@@ -1,9 +1,12 @@
import { after, before, describe } from 'node:test';

Copy link
Contributor Author

@demariadaniel demariadaniel Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up that multiple files include simple prettier cleanup changes to clear up the repo (mostly order of imports, whitespace, & falsy handling) or Typescript updates to declutter the repo.

The main change is the creation of a SearchClient which replaces instances of ElasticSearch Client.

const aggsState: I_AggsState[] = mappingToAggsState(mapping);
return { timestamp: timestamp(), state: aggsState };
};
(es: SearchClientType) =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All usage of @elastic Client is replaced by our SearchClientType

@demariadaniel demariadaniel self-assigned this Feb 9, 2026
const SearchClient = async (options: ESClientOptions | OSClientOptions) => {
const { ES_HOST } = ENV_CONFIG;
const searchConfig = await (await fetch(ES_HOST)).json();
const { distribution } = searchConfig.version;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See:
https://docs.opensearch.org/latest/api-reference/cluster-api/info/

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-info

Cluster Info provides a distribution field which lets us clearly identify when an OpenSearch instance is running.

This will need to be expanded when investigating ElasticSearch 8. But for OpenSearch hopefully the distribution field will suffice.

import { getProjectStorageMetadata, updateProjectIndexMetadata } from '../IndexSchema/utils';
import { type AllClients } from '#searchClient/index.js';

import { extendMapping } from '../../../mapping/index.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With types cleaned up I found extendMapping is undefined, not sure what this is actually meant to be

@demariadaniel demariadaniel changed the title WIP: Basic SearchClient WIP: #1141 Set Up Basic SearchClient Feb 11, 2026
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main changes here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant