Hi,
how do I select facets without aplied selected "facet filter"?
Original query https://gist.github.com/9bd1e1bc4bf289a576cc query with
aplied "facet filter" https://gist.github.com/a1eeda6e47f8e972e5df .
Diff with this two queries is add must term for user (from facets).
Hits is OK but I need same data in facets as first query. How to do it?
dadoonet
(David Pilato)
December 10, 2011, 7:42am
2
I think that you have to send two different request to ES.
HTH
David
@dadoonet
Le 10 déc. 2011 à 06:16, Patrik Votoček patrik@votocek.cz a écrit :
Hi,
how do I select facets without aplied selected "facet filter"?
Original query https://gist.github.com/9bd1e1bc4bf289a576cc query with
aplied "facet filter" https://gist.github.com/a1eeda6e47f8e972e5df .
Diff with this two queries is add must term for user (from facets).
Hits is OK but I need same data in facets as first query. How to do it?
Karussell1
(Karussell)
December 10, 2011, 5:59pm
3
I think that you have to send two different request to ES.
No, I think its possible to avoid binding the facet to the query. You
can change the scope of the facet via
"global" : true
Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
Also this search only filter could be of some use:
opened 10:52AM - 26 Jan 11 UTC
closed 10:55AM - 26 Jan 11 UTC
>feature
v0.15.0
When doing things like facet navigation, sometimes only the hits are needed to b… e filtered by the chosen facet, and all the facets should continue to be calculated based on the original query. The new `filter` element within the search request can be used to accomplish it.
For example, lets create two tweets, with two different tags:
```
curl -XPUT 'localhost:9200/twitter/tweet/1' -d '
{
"message" : "something blue",
"tag" : "blue"
}
'
curl -XPUT 'localhost:9200/twitter/tweet/2' -d '
{
"message" : "something green",
"tag" : "green"
}
'
curl -XPOST 'localhost:9200/_refresh'
```
We can now search for `something`, and have a `terms` facet.
```
curl -XPOST 'localhost:9200/twitter/_search?pretty=true' -d '
{
"query" : {
"term" : { "message" : "something" }
},
"facets" : {
"tag" : {
"terms" : { "field" : "tag" }
}
}
}
'
```
We get two hits, and the relevant facets with a count of `1` for both `green` and `blue`. Now, lets say the `green` facet is chosen, we can simply add a filter for it:
```
curl -XPOST 'localhost:9200/twitter/_search?pretty=true' -d '
{
"query" : {
"term" : { "message" : "something" }
},
"filter" : {
"term" : { "tag" : "green" }
},
"facets" : {
"tag" : {
"terms" : { "field" : "tag" }
}
}
}
'
```
And now, we get only 1 hit back, but the facets remain the same.
Note, if additional filters is required on specific facets, they can be added as a `facet_filter` to the relevant facets.
Peter.
On 10 Dez., 08:42, David Pilato da...@pilato.fr wrote:
I think that you have to send two different request to ES.
HTH
David
@dadoonet
Le 10 déc. 2011 à 06:16, Patrik Votoček pat...@votocek.cz a écrit :
Hi,
how do I select facets without aplied selected "facet filter"?
Original queryhttps://gist.github.com/9bd1e1bc4bf289a576ccquery with
aplied "facet filter"https://gist.github.com/a1eeda6e47f8e972e5df .
Diff with this two queries is add must term for user (from facets).
Hits is OK but I need same data in facets as first query. How to do it?
dadoonet
(David Pilato)
December 10, 2011, 6:11pm
4
That means that I have to learn more and more about ES !
David
@dadoonet
Le 10 déc. 2011 à 18:59, Karussell tableyourtime@googlemail.com a écrit :
I think that you have to send two different request to ES.
No, I think its possible to avoid binding the facet to the query. You
can change the scope of the facet via
"global" : true
Elasticsearch Platform — Find real-time answers at scale | Elastic
Also this search only filter could be of some use:
Search: Allow to pass a search filter, applying only on the query (and not on facets for example) · Issue #650 · elastic/elasticsearch · GitHub
Peter.
On 10 Dez., 08:42, David Pilato da...@pilato.fr wrote:
I think that you have to send two different request to ES.
HTH
David
@dadoonet
Le 10 déc. 2011 à 06:16, Patrik Votoček pat...@votocek.cz a écrit :
Hi,
how do I select facets without aplied selected "facet filter"?
Original queryhttps://gist.github.com/9bd1e1bc4bf289a576ccquery with
aplied "facet filter"https://gist.github.com/a1eeda6e47f8e972e5df .
Diff with this two queries is add must term for user (from facets).
Hits is OK but I need same data in facets as first query. How to do it?