-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Remove index.mapping.single_type=false from core/tests
#25331
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
Conversation
This change cleans up core tests to not use `index.mapping.single_type=false` but instead where applicable use a single type or markt the index as created with a pre 6.x version. Relates to elastic#24961
jpountz
left a comment
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 think it's a fair way to fix those tests. LGTM.
|
I dunno. I expected this process to consist more of removing multiple types in the tests and less of declaring indices to be old. The test names don't make it look like they are testing old index behavior. They mostly look like they intend to test "normal" index behavior. I think this kicks the can down to 7.0 when someone will have to look at these tests and decide weather to rewrite them with one type or just remove them. |
They do since they are using parent/child? |
I did convert quite a few of them, actually all of the ones that are possible and I invested a lot of time. I think you should look closer and tell me the ones that I missed. We are in-fact supporting multiple types for 5.x indices so we should also test the APIs against it. This is why I kept or duplicated a lot of them. |
martijnvg
left a comment
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
nik9000
left a comment
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 left a bunch of comments, mostly asking for comments explaining why we need multiple types and/or asking whether we should have a "single type" variant of tests.
| .addMapping("type1", mapping1, XContentType.JSON) | ||
| .addMapping("type2", mapping2, XContentType.JSON) | ||
| .setSettings("index.refresh_interval", -1, "index.mapping.single_type", false)); | ||
| .setSettings("index.refresh_interval", -1, "index.version.created", Version.V_5_6_0.id)); // multi types in 5.6 |
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.
If this is testing 5.x compat we should rename the test. It reads like it is testing stored fields with multiple values.
| .addMapping("my-type1", "_parent", "type=parent", "field1", "type=keyword,store=true") | ||
| .addAlias(new Alias("alias")) | ||
| .setSettings("index.refresh_interval", -1, "index.mapping.single_type", false)); | ||
| .setSettings("index.refresh_interval", -1, "index.version.created", Version.V_5_6_0.id)); // multi types in 5.6 |
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.
Maybe we're better off testing old style parent/child metadata in its own test. That way we can remove the entire test when we no longer support it. Maybe that'd be as simple as moving routing into another test and renaming the test.
|
|
||
| for (String index : Arrays.asList("foo", "foobar", "bar", "barbaz")) { | ||
| assertAcked(prepareCreate(index).setSettings("index.mapping.single_type", false)); | ||
| assertAcked(prepareCreate(index).setSettings("index.version.created", Version.V_5_6_0.id)); // allows for multiple types |
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.
Should this test have a multi-type variant and a single type variant?
|
|
||
| assertAcked(prepareCreate("indexa") | ||
| .setSettings("index.mapping.single_type", false) | ||
| .setSettings("index.version.created", Version.V_5_6_0.id) |
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.
Does this need a single-type variant?
| public void testSimpleGetMappings() throws Exception { | ||
| client().admin().indices().prepareCreate("indexa") | ||
| .setSettings("index.mapping.single_type", false) | ||
| .setSettings("index.version.created", Version.V_5_6_0.id) |
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 don't think multiple types are "simple" any more. Should this have a single type and a multi-type variant?
|
|
||
| assertAcked(prepareCreate("test_index") | ||
| .setSettings("index.mapping.single_type", false) | ||
| .setSettings("index.version.created", Version.V_5_6_0.id) // allow for multiple version |
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.
Is it worth adding a single type variant of this?
|
|
||
| assertAcked(prepareCreate("test").setSettings(builder.build()).addMapping("type1", type1TermVectorMapping()) | ||
| .addMapping("type2", | ||
| assertAcked(prepareCreate("test").setSettings(builder.build()).addMapping("type1", type1TermVectorMapping())); |
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.
Can you rename these indices? I know I'll get test and test1 mixed up. Even test1 and test2 would be better.
| public void testLoadMetadata() throws Exception { | ||
| assertAcked(prepareCreate("test") | ||
| .setSettings("index.mapping.single_type", false) | ||
| .setSettings("index.version.created", Version.V_5_6_0.id) |
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.
If we have another test for routing I'd rename this one to testLoadParent or something. Then we can nuke it in 7.0 easilly.
| assertThat(searchResponse.getHits().getHits().length, equalTo(3)); | ||
| } | ||
|
|
||
| public void testBasicQueryByIdMultiType() throws Exception { |
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.
👍
| public void testContextVariables() throws Exception { | ||
| assertAcked(prepareCreate("test") | ||
| .setSettings("index.mapping.single_type", false) | ||
| .setSettings("index.version.created", Version.V_5_6_0.id) |
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.
Maybe worth leaving a comment that we can remove this setting, the parent, and the second document once we no longer support types.
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.
wont' the test just fail in that case?
|
@nik9000 I pushed changes |
* master: (56 commits) Initialize max unsafe auto ID timestamp on shrink Enable a long translog retention policy by default (elastic#25294) Remove `index.mapping.single_type=false` from core/tests (elastic#25331) test: single type defaults to true since alpha1 and not alpha3 Get short path name for native controllers Live primary-replica resync (no rollback) (elastic#24841) Upgrade to lucene-7.0.0-snapshot-ad2cb77. (elastic#25349) percolator: Deprecate `document_type` parameter. [DOCS] Fixed typo. [rest-api-spec/indices.refresh] Remove old params Remove redundant and broken MD5 checksum from repository-s3 (elastic#25270) Initialize sequence numbers on a shrunken index Port most snapshot/restore static bwc tests to qa:full-cluster-restart (elastic#25296) Javadoc: ThreadPool doesn't reject while shutdown (elastic#23678) test: verify `size_to_upgrade_in_bytes` in assertBusy(...) Docs: Removed duplicated line in mapping docs Add backward compatibility indices for 5.4.2 Update MockTransportService to the age of Transport.Connection (elastic#25320) Add version v5.4.2 after release IndexMetaData: Add internal format index setting (elastic#25292) ...
This change cleans up core tests to not use
index.mapping.single_type=falsebut instead where applicable use a single type or markt the index as created
with a pre 6.x version.
Relates to #24961