Skip to content

TermVector support #519

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

Closed
Mpdreamz opened this issue Mar 3, 2014 · 7 comments
Closed

TermVector support #519

Mpdreamz opened this issue Mar 3, 2014 · 7 comments

Comments

@Mpdreamz
Copy link
Member

Mpdreamz commented Mar 3, 2014

No description provided.

@Mpdreamz Mpdreamz added this to the Unmapped 1.0 features milestone Mar 3, 2014
@gmarz
Copy link
Contributor

gmarz commented Mar 20, 2014

Hey @Mpdreamz,

Any attempt at this yet? I'm thinking about taking a crack at it.

@Mpdreamz
Copy link
Member Author

No would love it a PR for this!

NEST now thinly wraps around Elasticsearch.NET using RawDispatch, most of the infrastructure for support for termvector is there (raw call, dispatch call, querystring descriptor, call descriptor since all of that is generated) so it should be mostly creating a partial descriptor in NEST/DSL, creating a response object in NEST/DOMAIN/RESPONSES and the call on the client in a ElasticClient-Termvector.cs file.

There are some quirks around getting the code generation to work but if all is well you won't have to run it right now. I'll be sure to document it and provide build scripts for it.

This descriptor should be a good reference:
https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/DSL/CloseIndexDescriptor.cs
https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/ElasticClient-OpenClose.cs

See also all the generated code from the official client spec

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/DSL/_Descriptors.generated.cs

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/RawDispatch.generated.cs

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Elasticsearch.Net/Domain/QueryStringParameters.Generated.cs

@gmarz
Copy link
Contributor

gmarz commented Mar 23, 2014

Great! Thanks for the info, I'll give it a shot.

@gmarz
Copy link
Contributor

gmarz commented Mar 28, 2014

@Mpdreamz

I think there is a problem with the code generation for the TermvectorDescriptor.

Since term vectors are applied at the document level (/{index}/{type}/{id}/_termvector), it seems as though TermvectorDescriptor would need to inherit from DocumentPathDescriptorBase (not IndexPathDescriptor like the CloseIndexDescriptor does in your example above). However, it can't because it is not being generated as a generic type.

I'm not familiar enough with how the code generation works to fix this. I'm willing to try though if you can point me in the right direction.

@Mpdreamz
Copy link
Member Author

Ahh this is an excellent moment for me to write all of this down properly but for now I'll try to gist the procedure here.

First you need to target the "CodeGeneration" configuration this will only build the code generation tools.

All of the generators here:

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/DSL/_Descriptors.generated.cs

Are partial.

When you create a new descriptor here

https://github.com/elasticsearch/elasticsearch-net/tree/master/src/Nest/DSL

and make it generic like so:

https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Nest/DSL/IndexDescriptor.cs

When you run the codegeneration project now it will puck up on TermVectorDescriptor.cs and see that its generic and will make the generated part of the partial class in _Descriptors.Generated.cs of the same generic signature.

I will have to make a build target for this.

@gmarz
Copy link
Contributor

gmarz commented Mar 29, 2014

@Mpdreamz

Thanks, that worked! While running the code generation project, I found an issue with writing to the Cache folder when useCache = false. There wasn't a check to create the directory first if it isn't there. Just sent PR #548 that fixes that.

@Mpdreamz
Copy link
Member Author

Mpdreamz commented May 8, 2014

Thanks to @gmarz termvectors has now been mapped in NEST :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants