Skip to content
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fc96ec3
Make dense_vector fields updatable to bbq_flat/bbq_hnsw
tteofili May 22, 2025
1c13c5c
spotless
tteofili May 22, 2025
4a364bf
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili May 23, 2025
a031b6c
make it possible to test with synthetic source
tteofili May 26, 2025
5d0ead8
[CI] Auto commit changes from spotless
May 29, 2025
fea0749
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili May 29, 2025
19f273e
Merge branch 'dvm_update_bbq' of github.com:tteofili/elasticsearch in…
tteofili May 29, 2025
947e085
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 10, 2025
c8f5284
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 10, 2025
536485e
more tests
tteofili Jun 10, 2025
1ef5749
more tests
tteofili Jun 10, 2025
60269ec
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 10, 2025
ca13830
yaml test fix
tteofili Jun 10, 2025
c8d984a
Update docs/changelog/128291.yaml
tteofili Jun 10, 2025
40e5bf6
yaml test fix
tteofili Jun 10, 2025
fd4b5a3
Merge branch 'dvm_update_bbq' of github.com:tteofili/elasticsearch in…
tteofili Jun 10, 2025
a89bf3b
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 10, 2025
0284c18
refactoring
tteofili Jun 10, 2025
d769c17
missing yaml test capability, docs
tteofili Jun 10, 2025
c7f468a
missing path
tteofili Jun 10, 2025
d451d6b
spotless
tteofili Jun 10, 2025
6b8086b
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 11, 2025
467c9e4
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 11, 2025
a493a90
Merge branch 'main' of github.com:elastic/elasticsearch into dvm_upda…
tteofili Jun 16, 2025
bdfea1c
fix feature check
tteofili Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/128291.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 128291
summary: Make `dense_vector` fields updatable to bbq_flat/bbq_hnsw
area: Vector Search
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ POST /my-bit-vectors/_search?filter_path=hits.hits
To better accommodate scaling and performance needs, updating the `type` setting in `index_options` is possible with the [Update Mapping API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-mapping), according to the following graph (jumps allowed):

```txt
flat --> int8_flat --> int4_flat --> hnsw --> int8_hnsw --> int4_hnsw
flat --> int8_flat --> int4_flat --> bbq_flat --> hnsw --> int8_hnsw --> int4_hnsw --> bbq_hnsw
```

For updating all HNSW types (`hnsw`, `int8_hnsw`, `int4_hnsw`) the number of connections `m` must either stay the same or increase. For scalar quantized formats (`int8_flat`, `int4_flat`, `int8_hnsw`, `int4_hnsw`) the `confidence_interval` must always be consistent (once defined, it cannot change).
For updating all HNSW types (`hnsw`, `int8_hnsw`, `int4_hnsw`, `bbq_hnsw`) the number of connections `m` must either stay the same or increase. For the scalar quantized formats `int8_flat`, `int4_flat`, `int8_hnsw` and `int4_hnsw` the `confidence_interval` must always be consistent (once defined, it cannot change).

Updating `type` in `index_options` will fail in all other scenarios.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.common.Strings;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentType;

Expand Down Expand Up @@ -86,10 +87,21 @@ public void testDenseVectorMappingUpdateOnOldCluster() throws IOException {
String indexName = "test_index";
if (isOldCluster()) {
Request createIndex = new Request("PUT", "/" + indexName);
XContentBuilder mappings = XContentBuilder.builder(XContentType.JSON.xContent())
.startObject()
.startObject("mappings")
.startObject("properties")
boolean useSyntheticSource = randomBoolean() && getOldClusterTestVersion().after(Version.V_8_12_0.toString());
boolean useIndexSetting = SourceFieldMapper.onOrAfterDeprecateModeVersion(getOldClusterIndexVersion());
XContentBuilder payload = XContentBuilder.builder(XContentType.JSON.xContent()).startObject();
if (useSyntheticSource) {
if (useIndexSetting) {
payload.startObject("settings").field("index.mapping.source.mode", "synthetic").endObject();
}
}
payload.startObject("mappings");
if (useIndexSetting == false) {
payload.startObject("_source");
payload.field("mode", "synthetic");
payload.endObject();
}
payload.startObject("properties")
.startObject("embedding")
.field("type", "dense_vector")
.field("index", "true")
Expand All @@ -104,7 +116,7 @@ public void testDenseVectorMappingUpdateOnOldCluster() throws IOException {
.endObject()
.endObject()
.endObject();
createIndex.setJsonEntity(Strings.toString(mappings));
createIndex.setJsonEntity(Strings.toString(payload));
client().performRequest(createIndex);
Request index = new Request("POST", "/" + indexName + "/_bulk/");
index.addParameter("refresh", "true");
Expand Down
Loading
Loading