Is it possible to execute match_phrase_prefix in using hibernate search Query? I did not find any appropriate query class so far. I also don't want user ElasticsearchQueries.fromJson since I need to combine different conditions using bool
If you do not want to use ElasticsearchQueries.fromJson, then no, it's not possible to do that through the Hibernate Search APIs. That's a limitation of the experimental support for Elasticsearch in Hibernate Search 5.
It will be possible in Hibernate Search 6, but it's still an Alpha.
Related
We are using hibernate search api for elastic search. I came across lenient option in elastic search: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html but unable to figure out how can we set this through hibernate search.
Some of the fields in elastic search are boolean, and range, and we don't want to search through them.
There is no such option in Hibernate Search at the moment.
In Hibernate Search 5, you can write your whole query as JSON in order to take advantage of native options. That will require you to write everything as JSON, though, not just the simple-query-string query.
In Hibernate Search 6, you write just the simple-query-string predicate as JSON to take advantage of a native option in this predicate and continue using the Hibernate Search DSL for other predicates in the same query, which should be more convenient.
If you need the feature in the DSL, you can create a JIRA ticket and it will be addressed in Hibernate Search 6 if it makes it to the top of the priority list. If you need it before then, you can of course submit a pull request. Note that new features should go into Hibernate Search 6 (master branch), not Hibernate Search 5 which is currently in maintenance mode.
I am exploring Kibana for data exploration, and have created a query using KQL:
title:biologist or description:biology
I would like to use this same query as a saved filter that I would use in my dashboards. However, I can not find a way to convert this search to a filter.
I see that filters can be created using "Query DSL" that is a JSON config. I believe I can find a way to write my KQL search in Query DSL, but it seems there should be a way to convert my KQL search directly to a filter.
Or my understanding of filters vs queries needs some updating.
Thank you very much,
Jay, at the moment, Filters in Kibana use the AND syntax, there isn't an option for Or filters. You have a few options to do what you want:
Create a filter with one of the items, e.g. title:biologist and a query for the other. You could also edit a filter using DSL. Here's a link to the filters docs: https://www.elastic.co/guide/en/kibana/current/field-filter.html. For DSL, you can have a look here https://www.elastic.co/guide/en/elasticsearch/reference/7.3/query-dsl-bool-query.html#
How can I write aggregation query on a particular term in hibernate search using elastic search.Is there any way to do this?
If you are looking to perform faceting (which is one way of using aggregations), Hibernate Search provides a dedicated feature: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#query-faceting
If you want to aggregate for other purposes, I'm afraid this is not possible (yet) using Hibernate Search. We are planning to introduce it in Hibernate Search 6, though (or at least allow to perform aggregations by bypassing Hibernate Search's abstractions).
According to the the Elasticsearch 5 release note listing breaking changes , the geo_distance_range query is no longer supported.
Eventhough the official documentation doesn't state such a change, using this API is printing an error :
[geo_distance_range] queries are no longer supported for geo_point field types. Use geo_distance sort or aggregations
The suggestion is to use bucket aggregations instead of the geo_distance_range query feature.
But aggregations are by nature something quite different from applying a search filter (possibily in combination with other filters).
Is there any way to achieve the same thing as this feature originally provided in previous versions of Elastic search ?
I know there is a built-in DuplicateFilter in Lucene, to deduplicate the results from lucene. This is a very important feature for the users to search on the document database, where duplicating rate is very high.
As I am using Hibernate Search to do the full text index/search, and wondering if there is a way for me bring the DuplicateFilter on Lucene to the Hibernate Search?
It is possible by using filters. See for BestDriversFilter - it extends org.apache.lucene.search.Filter in the same way as DuplicateFilter.