# |
Jul 10th 2018, 09:27 |
josbeir |
you should denormalize your documents in ES |
# |
Jul 10th 2018, 09:26 |
josbeir |
well.. there is the catch |
# |
Jul 10th 2018, 09:26 |
james.phillips |
So I have an index class for each model I want to search via ES? |
# |
Jul 10th 2018, 09:26 |
josbeir |
make a cron job of it or something |
# |
Jul 10th 2018, 09:26 |
josbeir |
shell script is probably the simplest |
# |
Jul 10th 2018, 09:26 |
josbeir |
but you need to read up on the cake event system |
# |
Jul 10th 2018, 09:25 |
josbeir |
its not that hard |
# |
Jul 10th 2018, 09:25 |
neon1024 |
It isn’t. |
# |
Jul 10th 2018, 09:25 |
james.phillips |
sounds good. doesnt sound easy thou.... |
# |
Jul 10th 2018, 09:25 |
josbeir |
if you want to do it real time |
# |
Jul 10th 2018, 09:25 |
josbeir |
you could also use cake events to keep everything in sync |
# |
Jul 10th 2018, 09:25 |
james.phillips |
and push it all back? |
# |
Jul 10th 2018, 09:25 |
neon1024 |
..and all your data |
# |
Jul 10th 2018, 09:24 |
neon1024 |
Just remember that if you change your data types, you have to drop your index |
# |
Jul 10th 2018, 09:24 |
james.phillips |
so before save push data to ES ? |
# |
Jul 10th 2018, 09:24 |
josbeir |
or just use the index as your primary datasource but that should be considered carefully |
# |
Jul 10th 2018, 09:24 |
neon1024 |
A shell which ingests MySQL data to ES is a good idea |
# |
Jul 10th 2018, 09:24 |
james.phillips |
yep.... |
# |
Jul 10th 2018, 09:24 |
josbeir |
you could write a command that syncs the data from those tables to ES |
# |
Jul 10th 2018, 09:24 |
josbeir |
no prob, you want to make your tables searchable right? |
# |
Jul 10th 2018, 09:23 |
james.phillips |
btw thanks |
# |
Jul 10th 2018, 09:23 |
james.phillips |
and a eventsIndex class in cake |
# |
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 |