# |
Jul 10th 2018, 10:06 |
josbeir |
ah ok wait |
# |
Jul 10th 2018, 10:06 |
james.phillips |
"cakephp/elastic-search": "@stable" in composer json |
# |
Jul 10th 2018, 10:06 |
josbeir |
ah you want to compare the entire entity probably |
# |
Jul 10th 2018, 10:06 |
josbeir |
firstMatch() ? |
# |
Jul 10th 2018, 10:05 |
neon1024 |
What’s the quickest way to see if an entity value exists in an array of Entities? I’ve tried Collection::contains() but doesn’t seem to cut it |
# |
Jul 10th 2018, 10:05 |
josbeir |
it uses the new Plugin style |
# |
Jul 10th 2018, 10:05 |
josbeir |
2.0 is for 3.6+ |
# |
Jul 10th 2018, 10:05 |
james.phillips |
I have cake 3.5.5 |
# |
Jul 10th 2018, 10:04 |
josbeir |
its still up 2 date for saving and retrieving :slightly_smiling_face: |
# |
Jul 10th 2018, 10:04 |
josbeir |
check out the readme on git, ignore the setup part in the cake docs |
# |
Jul 10th 2018, 10:04 |
josbeir |
you are using the old plugin loading way |
# |
Jul 10th 2018, 10:04 |
josbeir |
in Application.php |
# |
Jul 10th 2018, 10:04 |
josbeir |
you need to use $this->addPlugin |
# |
Jul 10th 2018, 10:03 |
josbeir |
no |
# |
Jul 10th 2018, 10:03 |
james.phillips |
Plugin::load('Cake/ElasticSearch', ['bootstrap' => true]); |
# |
Jul 10th 2018, 10:03 |
josbeir |
or use IndexRegistry::get('Comments'); |
# |
Jul 10th 2018, 10:03 |
james.phillips |
ive added elastic plugin |
# |
Jul 10th 2018, 10:03 |
josbeir |
and indeed @james.phillips you need to add elastic :P |
# |
Jul 10th 2018, 10:03 |
lorenzo |
`$this->loadModel('Comments', 'elastic');` Load the `CommentsIndex` model from the `elastic` datasource |
# |
Jul 10th 2018, 10:03 |
james.phillips |
makes sense and that matchs my datasource name I added in my config |
# |
Jul 10th 2018, 10:03 |
josbeir |
@lorenzo thanks ! |
# |
Jul 10th 2018, 10:02 |
james.phillips |
so loadmodel elastic = datasource elastic |
# |
Jul 10th 2018, 10:01 |
james.phillips |
Im guessing i missed a step |
# |
Jul 10th 2018, 10:01 |
james.phillips |
theres where I grabbed the code from ... so when I add the following code to my existing controller I get that error message public function initialize() { parent::initialize(); $this->loadModel('Comments', 'elastic'); } |
# |
Jul 10th 2018, 10:01 |
lorenzo |
@josbeir https://github.com/cakephp/elastic-search/releases/tag/2.0.0-RC2 |
# |
Jul 10th 2018, 09:58 |
lorenzo |
read here https://github.com/cakephp/elastic-search#getting-a-index-object |
# |
Jul 10th 2018, 09:57 |
lorenzo |
`'elastic'` is not a model, it is a datasource |
# |
Jul 10th 2018, 09:56 |
james.phillips |
thank god for source control software to remind me what random stuff ive done |
# |
Jul 10th 2018, 09:55 |
james.phillips |
i still had $this->loadModel('elastic'); in my code from some other doc |
# |
Jul 10th 2018, 09:53 |
josbeir |
you are trying to retrieve a record or ? |
# |
Jul 10th 2018, 09:53 |
josbeir |
and when does this happen? |
# |
Jul 10th 2018, 09:52 |
james.phillips |
but if I change it to elastic123 it still says Error: Unknown repository type "elastic". Make sure you register a type before trying to use i |
# |
Jul 10th 2018, 09:51 |
james.phillips |
yep... 'elastic' => [ 'headers' => ['Authorization' => 'api-sfsadfas'], 'className' => 'Cake\ElasticSearch\Datasource\Connection', 'driver' => 'Cake\ElasticSearch\Datasource\Connection', 'host' => 'https://host-7djrft.api.swiftype.com/api/as/v1/engines/asdfasdfas/', 'port' => 9200, 'index' => '', ], |
# |
Jul 10th 2018, 09:49 |
josbeir |
is your datasource definition called 'elastic' ? |
# |
Jul 10th 2018, 09:48 |
josbeir |
can you show the stack trace? |
# |
Jul 10th 2018, 09:47 |
josbeir |
people would add very different information to all types in the same index |
# |
Jul 10th 2018, 09:47 |
james.phillips |
the auth header def did something cos i get a different error now ;) Error: Unknown repository type "elastic". Make sure you register a type before trying to use it. |
# |
Jul 10th 2018, 09:47 |
josbeir |
in ES prior to version 5 you had indexes and inside indexes there where types, pretty confusing |
# |
Jul 10th 2018, 09:46 |
josbeir |
mostly use the cake plugin or elastica |
# |
Jul 10th 2018, 09:46 |
josbeir |
its been a long time when i accessed ES rest methods directly |
# |
Jul 10th 2018, 09:45 |
josbeir |
yep |