Does Elastic AppSearch/UISearch support implementing free text search on large text fields ?
I would like to use ElasticSearchUI / SearchBox with option to search like:
"whale was seen in" + houston - dalas
I.e. use " " for exact match of string and +/- (or AND/OR) to include exclude other terms.
Is that possible by using Elastic AppSearch/UI search ? I'm using the react example app generated from Elasticsearch as base for my application, behavior of the provided SearchBox seems to be single word terms with OR as default between. I haven't found any config parameters to change that behavior, is it even possible?
Ok, I now see in the browser debugger that the query string looks like this when passed on to elastic app search: ""whale was seen in" + houston - dalas"
Is it perhaps just a matter of enabling Lucene Query Syntax in the App Search engine? (Or when creating the index ?) How to do that ?
The following test works on the test engine (national-parks-demo) using Search UI: "situated on" -olympic +yellowstone
The default behaviour when not using Lucene syntax is to try finding as many terms as possible, depending on the relevance of the terms. If you need to find specific terms, I'd suggest you use the Lucene syntax.
This will send in an Elasticsearch request that overrides app search’s configuration.If you use the explain API, though, you can see the queries that are being passed in and you can adjust them. The issue with lucene syntax today involves the minimum_should_match value, which often conflicts with Lucene’s boolean syntax logic.If you’re doing an AND search with a minimum_should_match of 1, it effectively becomes an OR query (only one needs to match).So it’s a bit of a workaround, but using explain to get the query you want and transforming it to Elasticsearch query DSL is the best way to have complete control over your result set.
Ok, thank for the feedback!
I think my problem is my index, I have created the index with elastic directly and not via app search.
When looking at the index in app search i see that message: "Missing subfields" for my text fields I'm searching in. Reading the docs I see that there are some subfields required for appsearch to work properly.
Ref:
I then tried to create a new index with a field "text" with subfields to try to mimic what is said in the link above (see mapping below). But still get same warning. Do you know how to create the subfields to get a field properly working with app search ? Should type be something else than text for the different sub fields ?
Now created a new index with following subfields added to the text fields and then string and exclusive search works as expected! Thanks for the support!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.