Skip to content
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

Support for version and version_type #7480

Closed
wants to merge 3 commits into from

Conversation

alexksikes
Copy link
Contributor

This commit adds support for version and version_type to the Term Vectors API. This could be useful in the following case whereby the user gets a document and later wants to generate its TVs. With version, this would ensure that only the TVs of that particular document are generated, and error out if the document has been updated in between.

@rjernst
Copy link
Member

rjernst commented Aug 27, 2014

LGTM. It would be nice to have some non-REST tests?

@jpountz
Copy link
Contributor

jpountz commented Aug 27, 2014

The change looks good to me too, but I'm wondering if version support is actually useful on term vectors? Do you have practical applications in mind?

@alexksikes
Copy link
Contributor Author

@jpountz Term vectors are near real-time, so this would make a lot more sense once TVs could be generated in real-time. Perhaps support for realtime could go in another commit? However, what should be the default, realtime: false or true? Or realtime: true if version is specified, and false otherwise?

@rjernst I think versioning itself is already thoroughly tested in non-REST tests. So it makes sense to test versioning for TVs only through REST-tests, just like for the get API?

@jpountz
Copy link
Contributor

jpountz commented Aug 27, 2014

@alexksikes I think I'm confused because the version parameter is something that is not implemented in the multi-get API (yet nobody complained?) so I'm wondering if it will be used at all in the termvector APIs?

@@ -392,6 +420,10 @@ public static void parseRequest(TermVectorRequest termVectorRequest, XContentPar
termVectorRequest.id = parser.text();
} else if ("_routing".equals(currentFieldName) || "routing".equals(currentFieldName)) {
termVectorRequest.routing = parser.text();
} else if ("_version".equals(currentFieldName) || "version".equals(currentFieldName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we're setting ourselves up for two different field names rather than just picking one (prefer _version)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same as for the get API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense.

@alexksikes
Copy link
Contributor Author

@jpountz I think it is implemented in the mget API. But anyway, I think that feature is useful. Suppose you get a document and want later to generate its TVs. This would ensure you only generate the TVs of that document, and error out if the document has been updated in between ...

@clintongormley
Copy link

@alexksikes do you still plan on merging this?

@alexksikes
Copy link
Contributor Author

@clintongormley Yes, I did run into a bug, so postponed it.

@alexksikes
Copy link
Contributor Author

OK rebased on master and ready for review.

@@ -140,7 +140,6 @@ else if (docIdAndVersion != null) {
throw new ElasticsearchException("failed to execute term vector request", ex);
} finally {
searcher.close();
get.release();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file make the assumption that the only thing that a Engine.GetResult.close release are the underlying searcher, I think it's too fragile

@jpountz
Copy link
Contributor

jpountz commented Dec 4, 2014

@alexksikes Just left one comment, other than that the change looks good. Like @rjernst I think we should have Java tests, which have better randomization than REST tests and allow to test the Java client API (for instance right now, there are no call sites for TermVectorsRequestBuilder.setVersion).

@jpountz
Copy link
Contributor

jpountz commented Dec 17, 2014

LGTM

@alexksikes alexksikes removed the review label Dec 17, 2014
@alexksikes alexksikes deleted the feature/tv-versionning branch December 17, 2014 14:51
@clintongormley clintongormley changed the title Term Vectors: support for version and version_type Support for version and version_type Jun 7, 2015
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Term Vectors labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Search/Search Search-related issues that do not fall into other categories v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants