-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Using Hibernate Search filters with Elasticsearch
PostPosted: Mon Nov 06, 2017 6:29 am 
Newbie

Joined: Mon Nov 06, 2017 6:17 am
Posts: 2
First of all thanks for the work you've done!

According to: https://docs.jboss.org/hibernate/stable ... /#_filters

Code:
    @Override
    public String getJsonFilter() {
        return "{ 'term': { 'name': '" + name + "' } }";
    }


I wonder why we have to return JSON string here, instead Query? You already have converters from Hibernate Query DSL to Elasticsearch JSON query, so why can't we benefit from it in filters?

What is the technical restriction for it, if there is any?


Top
 Profile  
 
 Post subject: Re: Using Hibernate Search filters with Elasticsearch
PostPosted: Tue Nov 07, 2017 5:58 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
hi again :)

technically you're right, the Query API could work in most cases.

But while today we have converters from Query to the Elasticsearch JSON counterpart, we created these converters only to make it easier for people on the current (previous) API to start using Elasticsearch.

We can't actually convert any type of Lucene Query, as people could possibly write their own sophisticated Query implementations and then we'd be unable to convert them correctly. Only by allowing people to write the JSON directly we can allow you to write the most advanced and custom queries, so its possible that in future we'll deprecate the Query<>JSON conversion, while the new APIs which we introduce - like this one - are already taking this into account.

I hope that addresses your question? I guess that for many simple cases we could also provide something simpler, but it's important that advanced users don't get stuck either.

I'd be happy to consider alternative proposals!

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Using Hibernate Search filters with Elasticsearch
PostPosted: Thu Nov 09, 2017 2:05 pm 
Newbie

Joined: Mon Nov 06, 2017 6:17 am
Posts: 2
sanne.grinovero wrote:
hi again :)

technically you're right, the Query API could work in most cases.

But while today we have converters from Query to the Elasticsearch JSON counterpart, we created these converters only to make it easier for people on the current (previous) API to start using Elasticsearch.

We can't actually convert any type of Lucene Query, as people could possibly write their own sophisticated Query implementations and then we'd be unable to convert them correctly. Only by allowing people to write the JSON directly we can allow you to write the most advanced and custom queries, so its possible that in future we'll deprecate the Query<>JSON conversion, while the new APIs which we introduce - like this one - are already taking this into account.

I hope that addresses your question? I guess that for many simple cases we could also provide something simpler, but it's important that advanced users don't get stuck either.

I'd be happy to consider alternative proposals!


Thanks for the clear explanation :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.