# |
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... |
# |
Jul 10th 2018, 09:13 |
neon1024 |
The configuration of your data source has nothing to do with Authentication |
# |
Jul 10th 2018, 09:13 |
neon1024 |
Don’t do that. |
# |
Jul 10th 2018, 09:13 |
james.phillips |
does anyone know who to set api auth under Datasources in app.php? |
# |
Jul 10th 2018, 09:11 |
neon1024 |
Perhaps table_alias and primary_key need to be a composite key? |
# |
Jul 10th 2018, 09:11 |
josbeir |
so your companies join in Users is also joined in your custom getPermissions query |
# |
Jul 10th 2018, 09:10 |
neon1024 |
The above SQL is also taking into account that in my CompaniesTable, the UserPermissions association has a condition set of `'conditions' => ['UserPermissions.table_alias' => 'Companies'],` which isn’t being applied to the join either |
# |
Jul 10th 2018, 09:10 |
josbeir |
thats indeed weird |
# |
Jul 10th 2018, 09:01 |
neon1024 |
So I feel like I’m stuck between a bad solution and a hack |
# |
Jul 10th 2018, 09:01 |
neon1024 |
File uploaded https://cakesf.slack.com/files/U1BT622HW/FBP0U1BM4/sql.sql / https://slack-files.com/T053DPNCM-FBP0U1BM4-50626cdba1 |
# |
Jul 10th 2018, 09:01 |
neon1024 |
You can contain them, without the left join, but then the query lacks the table alias in the join |