Return appropriate error on null dims update instead of npe (#125716)

Calling `Object::toString` was trying to call `null.toString()`, really
it should have been `Objects::toString`, which accepts `null`.

closes: https://github.com/elastic/elasticsearch/issues/125713
This commit is contained in:
Benjamin Trent 2025-03-26 17:47:20 -04:00 committed by GitHub
parent 83c0ca14f7
commit dd58b0b6fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 59 additions and 2 deletions

View file

@ -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