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

crud fails while trying to use with elasticsearch model #20

Closed
philippfrenzel opened this issue Sep 29, 2014 · 5 comments
Closed

crud fails while trying to use with elasticsearch model #20

philippfrenzel opened this issue Sep 29, 2014 · 5 comments

Comments

@philippfrenzel
Copy link

I don't guess this is an easy one... - maybe this can be fixed over the "id" which is available in all records...

@schmunk42
Copy link
Owner

Could you provide an example schema and some instruction how to test this?

@philippfrenzel
Copy link
Author

class ElasticSearchDocument extends \yii\elasticsearch\ActiveRecord
{
    /**
     * @return array the list of attributes for this record
     */
    public function attributes()
    {
        return [
            'id', 
            'index', 
            'type', 
            'score', 
            'explanation', 
            'highlight',
        ];
    }
}

So as elastic search doesn't return an pk this will fail within crud...

@schmunk42
Copy link
Owner

Just as a quick fix: Can't you workaround this by creating a base ActiveRecord for the models, which implements this function?

@philippfrenzel
Copy link
Author

yes, did it like this and you can return the primary key as if you have had multiple ones, which "fixes" it too... I'm just "playing" around... so no urgency here - thanks for the quick answer!

@schmunk42
Copy link
Owner

I think we can handle that in the models, please reopen or comment if you still have issues.

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