YousefED / ElasticUI

AngularJS directives for Elasticsearch
http://www.elasticui.com
Other
526 stars 135 forks source link

is it possible to use ElasticUI with elasticsearch 5.x? #107

Open seralf opened 7 years ago

seralf commented 7 years ago

Hi

I'm trying to use the library, using the demo as a quick reference, for creating a small prototype with Elasticsearch 5.x. When I click on a single or multiple facet, i get the following error:

...Unknown key for a START_OBJECT in [filter]...

The problem seems to be related to the construction of filter part in the elasticsearch DSL, which -at least as far as I konw- had some chenges during the last updates. Where do I have to look for, for updating the query creation in order to make the demo applyable to versions 5.x? thank in advance for any suggestion

tackaberry commented 7 years ago

@seralf did you happen to figure this out?

seralf commented 7 years ago

no sorry, I did some testing, but then I had no more time to invest in explorations / other testing, and at the moment I can't use the library in my prototype :-(

jedihe commented 7 years ago

Update: proper fix below.

I hit the same issue and found a work around: ES 5.x doesn't support "filter" in the top-level for the search request; ElasticUI sets it when a eui-filter is defined. The solution I found was to not use eui-filter, but instead build any kind of filtering behavior directly in the aggregations/query like this ejs.FilterAggregation().filter(ejs.SomeFilter).agg(OriginalAggregation)

Unfortunately, doing this breaks the mechanism that makes the aggregation result available in aggResult variable... I'm still trying to solve that.

jedihe commented 7 years ago

Just opened a PR (#109) with a solution for this: replace deprecated Request.filter() with Request.post_filter(), both in elastic.js and elasticui.

Deprecation record: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/breaking_50_search_changes.html#_top_level_literal_filter_literal_parameter Docs for post_filter: https://www.elastic.co/guide/en/elasticsearch/reference/5.1/search-request-post-filter.html

Even though post_filter seems to work a bit differently than how filter did, ElasticUI already injects all the filters explicitly into the aggregations, which should guarantee that the behavior stays the same.

Hopefully somebody will find the time to properly upstream the change to elastic.js and run the build for ElasticUI (instead of directly hacking the unminified version as I did).

YousefED commented 7 years ago

Hi Guys,

Sorry for the delay. Thanks for the work on this. As you might have noticed I'm not very active in this project anymore. If anyone would love to help out, I'd be happy to give complete contributor access to bring ElasticUI up to par with the latest angular / elastic versions :)

seralf commented 7 years ago

Thanks YousefED for the updates

Uhm I'm not sure about how many time I could spend for a full support. I suggest you could write some lines to illustrate the main component and where to start, so people can eventually divide the work between different committers. my 2 cents