elastic / elastic/semantic-code-search-indexer

enhancement: make code_vector mapping conditional when ENABLE_DENSE_VECTORS is false

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
19
Forks
10
PR merge metrics
No merged PRs in 30d

Description

## Problem
The index mapping always defines `code_vector` as an indexed `dense_vector` field:
- `index: true`

Even when `ENABLE_DENSE_VECTORS` is disabled, this mapping can still increase index overhead (storage, indexing CPU) and potentially require extra cluster resources.

## Where in code
- `src/utils/elasticsearch.ts` in `createIndex()` mapping for `code_vector`.

## Suggested fix
Options:
1) Only include the `code_vector` field mapping when `ENABLE_DENSE_VECTORS=true`.
2) Keep the field but set `index: false` unless enabled.

## Notes
This is a mapping change; deployments will need a clean reindex to pick it up.

## Test plan
- Unit test for `createIndex` mapping generation (mock client) verifying `code_vector` is omitted or non-indexed when disabled.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read src/utils/elasticsearch.ts, focusing on createIndex() and the code_vector mapping. Run or add the planned unit test with a mocked client, then verify the generated mapping does not index code_vector when ENABLE_DENSE_VECTORS is disabled while preserving the enabled case.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, typescript
Domain
search
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.