-
Notifications
You must be signed in to change notification settings - Fork 736
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
get result as document #960
Comments
Currently this is not directly supported by Elastica. It was requested several times in the past but nobody implemented it so far. It shouldn't be too hard to implement it on top of ResultSet or Result. It would required to create document objects based on the retrieved values. |
ok - .. you can leave open for a little and I'll see if I can do it. I On Mon, Oct 19, 2015 at 9:48 AM, Nicolas Ruflin [email protected]
|
👍 Let me know if you need some help. |
Thanks! I'm building an ORM like structure using Elastica - this is the part in my constructor where I handle Elastic\Result
a few things I'm not sure about:
Like I said, I assume there should be some Any other ideas based on your experience with ES? ps - thank you so much for Elastica - it's really amazing! |
The line Good point about the fields. I think the creation of the documents should be triggered by a separate function as not all cases will support this. In this case if no fields exist an exception can be thrown. Which cases it work should be part of the function doc header. Again, lets make baby step. Have a function that works in the standard cases but throw an exception if not all data we need exists. I think important will be to add some integration tests to see if it works as expected. |
Thanks for the comments. I don't set a version in the doc, will it do a check? If not, if the version isn't set in the request then the doc will not have it and it'll save fine anyway. You say
About adding the index/type. When I normally get back a document from a primary key lookup, do I also have the index and type? I'm not familiar enough with the interplay between documents and index/types. What do you mean that the creation of the doc should be in a separate function? I'm assuming there will be a specific factory function in Elastica (maybe Elastica\Document). I don't think in the main class I would put in the constructor - I just did it my class because it's an ORM. Perhaps something like Elastica\Document::createFromResult. There could also be a createFromResultSet as a helper to do the looping. What do you think about these directions? |
|
@yehosef Any updates here? |
sorry - I haven't worked on this any more. I think the approach with the |
@yehosef Do you have any plans to continue work on it? |
A good idea. I'm thinking about the same and found this issue. Are needed methods ResultSet->getDocuments() and Result->getDocument() |
I would like to query for some documents, make changes to them, and then save them again. Normally when getting a single doc by primary key, I get an elastica\document and make the changes via that.
I would also like to use this approach when retrieving a Elastica\ResultSet or Result. I would like to either retrieve this as a Document or convert it to one (eg, including the version info). Is this possible? And if not, could there be a way to do it?
The text was updated successfully, but these errors were encountered: