# |
Jul 10th 2018, 09:23 |
james.phillips |
working the other way.. I have an events table entity and table in Cake... I need a events index in ES? |
# |
Jul 10th 2018, 09:22 |
james.phillips |
Sorry i'm being thick.... |
# |
Jul 10th 2018, 09:22 |
josbeir |
so take you have an index in ES 'products', you would have a class ProductsIndex |
# |
Jul 10th 2018, 09:22 |
neon1024 |
You can’t save stuff into ES without an index to save to |
# |
Jul 10th 2018, 09:22 |
josbeir |
well.. the index ORM class that will talk to the ES index |
# |
Jul 10th 2018, 09:22 |
james.phillips |
the index within ES? |
# |
Jul 10th 2018, 09:21 |
josbeir |
the name of your index ? |
# |
Jul 10th 2018, 09:21 |
james.phillips |
$index = IndexRegistry::get('Foo'); what is Foo ? |
# |
Jul 10th 2018, 09:21 |
josbeir |
or getAggregations() |
# |
Jul 10th 2018, 09:21 |
josbeir |
getAggregation i mean :P |
# |
Jul 10th 2018, 09:20 |
josbeir |
$resultset->aggregations(); |
# |
Jul 10th 2018, 09:20 |
josbeir |
it works perfectly |
# |
Jul 10th 2018, 09:20 |
neon1024 |
As if you wanted flat fast, you could use Redis |
# |
Jul 10th 2018, 09:20 |
josbeir |
$doc = $index->newEntity(['foo' => 'bar']); $index->save($doc); |
# |
Jul 10th 2018, 09:20 |
neon1024 |
I don’t know how it works with Aggregations though |
# |
Jul 10th 2018, 09:20 |
josbeir |
$index = IndexRegistry::get('Foo'); $results = $index->find()->where(['bar' => 'baz']); |
# |
Jul 10th 2018, 09:20 |
james.phillips |
Well I have an existing app and I want to add elastic search to be able to do fuzzy, stemming etc as easy as possible |
# |
Jul 10th 2018, 09:19 |
josbeir |
with the cake ES plugin you can use ORM stuff built on top of elastica |
# |
Jul 10th 2018, 09:19 |
james.phillips |
thanks |
# |
Jul 10th 2018, 09:19 |
josbeir |
what do you mean @james.phillips |
# |
Jul 10th 2018, 09:19 |
josbeir |
dep tree: cakephp/elasticsearch => ruflin/elastica => elasticsearch/elasticsearch |
# |
Jul 10th 2018, 09:18 |
james.phillips |
lol confused... does the plugin auto save data to ES and query it? |
# |
Jul 10th 2018, 09:18 |
neon1024 |
Leveraging the ORM will be super handy, as writing your own queries in json is a PITA |
# |
Jul 10th 2018, 09:18 |
neon1024 |
I implemented their own library and it was kinda hard work |
# |
Jul 10th 2018, 09:18 |
josbeir |
so you can use that too if you want to write more complex stuff |
# |
Jul 10th 2018, 09:17 |
josbeir |
it uses elastica |
# |
Jul 10th 2018, 09:17 |
james.phillips |
better than using something liek http://elastica.io/getting-started/storing-and-indexing-documents.html? |
# |
Jul 10th 2018, 09:17 |
josbeir |
its pretty good :slightly_smiling_face: |
# |
Jul 10th 2018, 09:17 |
josbeir |
yes |
# |
Jul 10th 2018, 09:17 |
james.phillips |
is the es plugin the best way to add elasticsearch to cakephp? |
# |
Jul 10th 2018, 09:16 |
josbeir |
i'm not sure authentication is currently working in the ES plugin but it probably can be added in the connection class |
# |
Jul 10th 2018, 09:16 |
james.phillips |
Im not sure...Authorization: Bearer is what i need to set i think |
# |
Jul 10th 2018, 09:16 |
neon1024 |
Then when I make the request, I’ll read from Configure |
# |
Jul 10th 2018, 09:16 |
neon1024 |
I tend to use `bootstrap.php` and use `Configure::write()` |
# |
Jul 10th 2018, 09:15 |
josbeir |
@james.phillips i'm guessing its for x-pack auth? |
# |
Jul 10th 2018, 09:15 |
james.phillips |
Yep where do you put the elastic search api key they give u?! |
# |
Jul 10th 2018, 09:15 |
james.phillips |
i have 'elastic' => [ 'className' => 'Cake\ElasticSearch\Datasource\Connection', 'driver' => 'Cake\ElasticSearch\Datasource\Connection', 'host' => 'https://host-7djrft.api.swiftype.com/api/as/v1/engines/xxxx/', 'port' => 9200, 'index' => '', in app.php under datasources |
# |
Jul 10th 2018, 09:14 |
neon1024 |
Do you mean this? https://github.com/cakephp/elastic-search#defining-a-connection |
# |
Jul 10th 2018, 09:14 |
james.phillips |
I have Plugin::load('Cake/ElasticSearch', ['bootstrap' => true]); in bootstrap |
# |
Jul 10th 2018, 09:14 |
neon1024 |
You’ll want to write a new authentication adapter for your web service |
# |
Jul 10th 2018, 09:14 |
james.phillips |
Its for elastic search... |