haystack elasticsearch facet but disregard filters on this query - elasticsearch

Using haystack solr I can do this:
# facet by category but disregard any category filters on this query
squeryset = squeryset.facet('{!ex=category}category')
which will give me facets for the category but ignore any category filters
Now how do I do the same query using elasticsearch?
It's for when someone queries for something with a specific category, I can show the counts for the other categories they did not select.

I was looking for the same thing. See http://demo.fullscale.co/multiselect/ for a working demo to do this in ES. It is however not supported by Haystack. I'm working on that to make it work.
Paul

Related

How to filter the aggregation results in Kibana (elastic search)?

I want to filter the elastic search aggregation results in Kibana (v6.2). For example, I want to show only sum of hours those that are more than 100 (like HAVING command in SQL). I know that we can filter the results in filter section over other fields, but I don't know how to apply the filter on aggregation functions. I tried to use post_filter in filter section in Kibana, but it didn't work.
Any ideas?
You can augment aggregation query within advanced field
It will be added to request as shown on picture
Another question is what to put into this field. You can check script values for sum aggregation

Can ElasticSearch do fuzzy aggregation

For example I have two docs such as: doc1={"ename":"pop2 up3 donw1"}, doc2={"ename":"up3 pop2"}. Because they looks similar, I wanna they can be aggregated to one item by field ename. So I called it Fuzzy Aggregation.Does ES have the above feature please.

filtering out docs that have a word from a stop list

I have a search query for some such as "match":{"product name":"glasses car"} so that I am looking for glasses or cars (or both).
But I want to exclude the docs that have google glass or google car in them. so how would I filter them out?
I could use a bool query and use must_not for google, but then I will lose the scoring and get a constant score.
You should use a filtered query with a filter to exclude words like google and keep your main search as the query.
The filter does not affect scoring, only the query part of the filtered query does.
You can find a small example on the Filtered Query page in the ElasticSearch documentation.

Lucene.NET: Query or Filter?

It is my understanding that documents are found based on a query, and then that result is then filtered by the filter.
The Query is the only that that will effect the score/relevance of a document.
Would there be any performance (caching) improvements if I query results that have relevance towards relevancy, and filter items that don't?
Here is my situation. I have a lot of products, and the website will often search for products by category or manufacturer. I was thinking about using queries for that as that will bring the products down to a smaller subset which can be cached. I can then filter my results by product specifications. Should I use filters for specifications? That way we can filter based on an already cached (by lucene) subset of products (category or manufacturer).
Using filters also does not affect the returned score whereas additional terms in a query do. You should use filters, for example, if a user picks a certain category from a list of available categories as facets :
Category : Electricals
Query Terms : DSLR Camera
Resultant scores (relevancy) are based on the query terms other than a hit on the category
The difference between filter and query is mostly that filter is exact. If you filter on brand=... than you will only get that exact brand. If you query on it, you will get the brand and possibly other results that also match your query.
So the question is, do you want an exact filter, or is it just for relevance?
Filtering provides a mechanism to further restrict the results of a query and provide a possible performance gain if the same query is run multiple times.
We mostly use filters for security - this would provide performance gains as results of the query are cached.

How to filter results based on order in Solr?

I need to facet inside n documents which are selected like
... ORDER BY something DESC LIMIT 100
Is that possible with Solr? How?
this is a total hack, but here goes...
do your initial query, and get your results back.
construct a new query, like so:
http://localhost:8080/solr/select/?q=id%3A123+OR+id%3A456...(keep OR-ing them up)...&facet=true&facet.field=something
where you concatenate all of your ids to a new query using OR. then, when you facet on your field, the facet summary will only apply to the results.
AFAIK no, that's not supported / implemented. Facets aren't really meant to be "stats" but a guidance to the end-user. Picture yourself browsing a faceted interface and seeing facets change whenever you change sort order or paging. Faceted browsing would be useless if it worked like that.
I think this would be a nice feature for the StatsComponent though.
I think this is possible with results grouping (now in trunk!):
http://wiki.apache.org/solr/FieldCollapsing
... the only problem is that you can set only one 'facet.field' (i.e. group.field)
But the great thing is that you get scored facets!

Resources