Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/125716.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 125716
summary: Return appropriate error on null dims update instead of npe
area: Vector Search
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -605,3 +605,28 @@ setup:
- match: { hits.hits.0._score: $knn_score0 }
- match: { hits.hits.1._score: $knn_score1 }
- match: { hits.hits.2._score: $knn_score2 }
---
"Updating dim to null is not allowed":
- requires:
cluster_features: "mapper.npe_on_dims_update_fix"
reason: "dims update fix"
- do:
indices.create:
index: test_index

- do:
indices.put_mapping:
index: test_index
body:
properties:
embedding:
type: dense_vector
dims: 4
- do:
catch: bad_request
indices.put_mapping:
index: test_index
body:
properties:
embedding:
type: dense_vector
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MapperFeatures implements FeatureSpecification {
public static final NodeFeature SPARSE_VECTOR_STORE_SUPPORT = new NodeFeature("mapper.sparse_vector.store_support");
public static final NodeFeature SORT_FIELDS_CHECK_FOR_NESTED_OBJECT_FIX = new NodeFeature("mapper.nested.sorting_fields_check_fix");
public static final NodeFeature DYNAMIC_HANDLING_IN_COPY_TO = new NodeFeature("mapper.copy_to.dynamic_handling");
static final NodeFeature NPE_ON_DIMS_UPDATE_FIX = new NodeFeature("mapper.npe_on_dims_update_fix");

@Override
public Set<NodeFeature> getTestFeatures() {
Expand All @@ -51,7 +52,8 @@ public Set<NodeFeature> getTestFeatures() {
DYNAMIC_HANDLING_IN_COPY_TO,
SourceFieldMapper.SYNTHETIC_RECOVERY_SOURCE,
ObjectMapper.SUBOBJECTS_FALSE_MAPPING_UPDATE_FIX,
DateFieldMapper.INVALID_DATE_FIX
DateFieldMapper.INVALID_DATE_FIX,
NPE_ON_DIMS_UPDATE_FIX
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public static class Builder extends FieldMapper.Builder {
}

return XContentMapValues.nodeIntegerValue(o);
}, m -> toType(m).fieldType().dims, XContentBuilder::field, Object::toString).setSerializerCheck((id, ic, v) -> v != null)
}, m -> toType(m).fieldType().dims, XContentBuilder::field, Objects::toString).setSerializerCheck((id, ic, v) -> v != null)
.setMergeValidator((previous, current, c) -> previous == null || Objects.equals(previous, current))
.addValidator(dims -> {
if (dims == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static class Builder extends FieldMapper.Builder {
}

return XContentMapValues.nodeIntegerValue(o);
}, m -> toType(m).fieldType().dims, XContentBuilder::field, Object::toString).setSerializerCheck((id, ic, v) -> v != null)
}, m -> toType(m).fieldType().dims, XContentBuilder::field, Objects::toString).setSerializerCheck((id, ic, v) -> v != null)
.setMergeValidator((previous, current, c) -> previous == null || Objects.equals(previous, current))
.addValidator(dims -> {
if (dims == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,28 @@ setup:
id: "1"
body:
vector1: [[2, -1, 1], [[2, -1, 1]]]
---
"Updating dim to null is not allowed":
- requires:
cluster_features: "mapper.npe_on_dims_update_fix"
reason: "dims update fix"
- do:
indices.create:
index: test_index

- do:
indices.put_mapping:
index: test_index
body:
properties:
embedding:
type: rank_vectors
dims: 4
- do:
catch: bad_request
indices.put_mapping:
index: test_index
body:
properties:
embedding:
type: rank_vectors