-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Transform] Add _meta field to TransformConfig #79003
[Transform] Add _meta field to TransformConfig #79003
Conversation
4ffd408
to
728176b
Compare
Pinging @elastic/ml-core (Team:ML) |
...-high-level/src/main/java/org/elasticsearch/client/transform/transforms/TransformConfig.java
Outdated
Show resolved
Hide resolved
...level/src/main/java/org/elasticsearch/client/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Outdated
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments:
- we should add a mapping(
FLATTENED
) toTransformInternalIndex
, this is not strictly required as dynamic mappings are turned off, but we do the same for other fields -> consistency - it would be nice to not allow arbitrary sized meta entries, the other parts of the config are somewhat limited by nature (assuming no one is writing a monster aggregation), but meta is unlimited
- however that's hard to achieve with the current parser
- we could as alternative limit the Rest Request (
RestPutTransformAction
)
- +1 regarding the idea of using
LinkedHashMap
to preserve order
...e/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
728176b
to
4ad0959
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments:
we should add a mapping(FLATTENED) to TransformInternalIndex, this is not strictly required as dynamic mappings are
turned off, but we do the same for other fields -> consistency
Done.
it would be nice to not allow arbitrary sized meta entries, the other parts of the config are somewhat limited by nature
(assuming no one is writing a monster aggregation), but meta is unlimited
however that's hard to achieve with the current parser
we could as alternative limit the Rest Request (RestPutTransformAction)
And also RestUpdateTransformAction
, right?
What limit do you think makes sense here? Any prior art?
+1 regarding the idea of using LinkedHashMap to preserve order
Done.
...-high-level/src/main/java/org/elasticsearch/client/transform/transforms/TransformConfig.java
Outdated
Show resolved
Hide resolved
...level/src/main/java/org/elasticsearch/client/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java
Outdated
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Show resolved
Hide resolved
...in/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java
Show resolved
Hide resolved
@@ -173,6 +189,9 @@ public void writeTo(final StreamOutput out) throws IOException { | |||
if (out.getVersion().onOrAfter(Version.V_7_8_0)) { | |||
out.writeOptionalWriteable(settings); | |||
} | |||
if (out.getVersion().onOrAfter(Version.V_8_0_0)) { | |||
out.writeMapWithConsistentOrder(metadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this to cause an assertion failure when used in conjunction with mapOrdered
if we have good test coverage:
elasticsearch/server/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java
Line 536 in 39234ab
assert false == (map instanceof LinkedHashMap); |
For a linked hash map just writeMap
should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I think this is probably fine, it iterates the keys and since LinkedHashMap has consistent order, that will work.
On reading though, this means that you cannot use readMap
, you will need to readOrderedMap
or whatever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, if you could just fix a couple of field names in the docs
...e/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigUpdate.java
Show resolved
Hide resolved
no prior art as far as I know. I think if we limit to Note, I am not concerned about a single put or update request. The real issue is getting the configs in some internal places where we sometimes retrieve 100, sometimes up to 10k at a time. |
a321db3
to
3896ae7
Compare
run elasticsearch-ci/part-2 |
Ok. I've added a limit of 5MB to both Put and Update. I've manually verified (by temporarily lowering the limit) that an exception when the request is too large. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds a new field (called
_meta
) to theTransformConfig
.This
_meta
field stores an arbitrary key-value map.Keys are strings.
Values are arbitrary objects (possibly also maps).
The
_meta
map is updatable via_update
endpoint in Transform API.Relates #77506