ESQL: Remove the NESTED DataType#111495
Conversation
We don't support nested fields at the moment and when we do I'm not sure it'll *be* a DataType. Maybe. Probably. But let's deal with that when we support it.
| DataType esDataType = getType(content); | ||
| final Map<String, EsField> properties; | ||
| if (esDataType == OBJECT || esDataType == NESTED) { | ||
| if (esDataType == OBJECT) { |
There was a problem hiding this comment.
This is from Types in QL, but it's only used in testing in ESQL. I think this safe for now.
| // allow compound object even if they are unknown (but not NESTED) | ||
| if (type != NESTED && fieldProperties.isEmpty() == false) { | ||
| // allow compound object even if they are unknown | ||
| if (fieldProperties.isEmpty() == false) { |
There was a problem hiding this comment.
This is the most interesting line, I think. But we don't make NESTED any more so I feel like this is pretty safe.
There was a problem hiding this comment.
So this would change things. It'd make the sub-fields of the NESTED object appear. I think. I'll double check.
There was a problem hiding this comment.
Yeah, I think this is ok. Stuff like object with sub-fields still work 👍 ; I tested an empty index with this kind of mapping:
"name": {
"type": "object",
"properties": {
"first_name": {
"type": "keyword"
},
"last_name": {
"type": "keyword"
}
}
}
and we get back only name.first_name and name.last_name. Which I think it's ok? Now I'm wondering if OBJECT has the same treatment as NESTED, since it disappears.
Also, nested doesn't seem to accept fields, but what it does (and I forgot about it) is include_in_parent but I don't think we ever supported this since _field_caps behaves identically with include_in_parent true or false.
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
I talked with @astefan and I'm going to make a yaml test that uses nested just to make sure we're not doing something really unexpected. It should be fine, but let's be super careful here. |
|
Mechanically what happens for |
We don't want this. At least, it's a change and maybe not a good one. |
|
OK! I've moved the filtering of |
astefan
left a comment
There was a problem hiding this comment.
I think it's ok to remove this data type and I hope we are careful enough with this step.
Maybe add two-three more to 40_unsupported_types.yml with a mapping that more paranoid:
"name": {
"type": "object",
"properties": {
"first_name": {
"type": "keyword"
},
"last_name": {
"type": "keyword"
}
}
},
"bla": {
"type": "object",
"properties": {
"obj": {
"type": "object",
"properties": {
"first_name": {
"type": "keyword"
},
"last_name": {
"type": "keyword"
}
}
}
}
},
"nested": {
"type": "nested",
"properties": {
"sub_nested": {
"type": "nested",
"properties": {
"first_name": {
"type": "keyword"
}
}
},
"last_name": {
"type": "keyword"
}
}
}
| // allow compound object even if they are unknown (but not NESTED) | ||
| if (type != NESTED && fieldProperties.isEmpty() == false) { | ||
| // allow compound object even if they are unknown | ||
| if (fieldProperties.isEmpty() == false) { |
There was a problem hiding this comment.
Yeah, I think this is ok. Stuff like object with sub-fields still work 👍 ; I tested an empty index with this kind of mapping:
"name": {
"type": "object",
"properties": {
"first_name": {
"type": "keyword"
},
"last_name": {
"type": "keyword"
}
}
}
and we get back only name.first_name and name.last_name. Which I think it's ok? Now I'm wondering if OBJECT has the same treatment as NESTED, since it disappears.
Also, nested doesn't seem to accept fields, but what it does (and I forgot about it) is include_in_parent but I don't think we ever supported this since _field_caps behaves identically with include_in_parent true or false.
👍 |
|
That snapshot failures are real - old versions sometimes send When we serialize |
Fields. To the fields. @astefan check out the transport change I just pushed. It looks like we serialize the mapping of the index in addition to the |
|
@astefan I pushed a change just now to explain the reading change better. It's to do with the way we reuse a function for serialization. |
|
Thank you @nik9000 |
That sounds like and approal. I'm mash the merge button. Let me know if you have any more ideas around this one. It's been a trip! |
* upstream/main: (132 commits) Fix compile after several merges Update docs with new behavior on skip conditions (elastic#111640) Skip on any instance of node or version features being present (elastic#111268) Skip on any node capability being present (elastic#111585) [DOCS] Publishes Anthropic inference service docs. (elastic#111619) Introduce `ChunkedZipResponse` (elastic#109820) [Gradle] fix esql compile cacheability (elastic#111651) Mute org.elasticsearch.datastreams.logsdb.qa.StandardVersusLogsIndexModeChallengeRestIT testTermsQuery elastic#111666 Mute org.elasticsearch.datastreams.logsdb.qa.StandardVersusLogsIndexModeChallengeRestIT testMatchAllQuery elastic#111664 Mute org.elasticsearch.xpack.esql.analysis.VerifierTests testMatchCommand elastic#111661 Mute org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizerTests testMatchCommandWithMultipleMatches {default} elastic#111660 Mute org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizerTests testMatchCommand {default} elastic#111659 Mute org.elasticsearch.xpack.esql.optimizer.LocalPhysicalPlanOptimizerTests testMatchCommandWithWhereClause {default} elastic#111658 LogsDB qa tests - add specific matcher for source (elastic#111568) ESQL: Move `randomLiteral` (elastic#111647) [ESQL] Clean up UNSUPPORTED type blocks (elastic#111648) ESQL: Remove the `NESTED` DataType (elastic#111495) ESQL: Move more out of esql-core (elastic#111604) Improve MvPSeriesWeightedSum edge case and add more tests (elastic#111552) Add link to flood-stage watermark exception message (elastic#111315) ... # Conflicts: # server/src/main/java/org/elasticsearch/TransportVersions.java
We don't support nested fields at the moment and when we do I'm not sure it'll *be* a DataType. Maybe. Probably. But let's deal with that when we support it.
We don't support nested fields at the moment and when we do I'm not sure it'll *be* a DataType. Maybe. Probably. But let's deal with that when we support it.
We don't support nested fields at the moment and when we do I'm not sure it'll be a DataType. Maybe. Probably. But let's deal with that when we support it.