Should the facet_filter only returns results from that specified facet?

Hi,

i´m not sure if i really understand facet_filter. I have a query +
facets + a facet_filter.

Applying the facet_filter only the facet specified is returned. OK.
But i still get all results from the query..

Say facet X is not displayed as it was filtered, i still get results
only available under facet X. Is this a normal behaviour ?

What does my query / query_string look like if i want to show all
tweets by user "john" that contains the string "text" and are tagged
with the color "blue" ?

thy a lot!

This is nicely (IMO :)) explained here:

Peter.

On 21 Dez., 05:13, mrblue john.agricola...@googlemail.com wrote:

Hi,

i´m not sure if i really understand facet_filter. I have a query +
facets + a facet_filter.

Applying the facet_filter only the facet specified is returned. OK.
But i still get all results from the query..

Say facet X is not displayed as it was filtered, i still get results
only available under facet X. Is this a normal behaviour ?

What does my query / query_string look like if i want to show all
tweets by user "john" that contains the string "text" and are tagged
with the color "blue" ?

thy a lot!

Hi John

i´m not sure if i really understand facet_filter. I have a query +
facets + a facet_filter.

Applying the facet_filter only the facet specified is returned. OK.
But i still get all results from the query..

There are numerous places that filters can be applied:

  • to a query (affects facets and results)
  • to a search (affects results but not facets)
  • to a facet (affects facets but not results)

What does my query / query_string look like if i want to show all
tweets by user "john" that contains the string "text" and are tagged
with the color "blue" ?

Your query for the above could look something like this:

curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"and" : [
{
"term" : {
"tag" : "blue"
}
},
{
"term" : {
"user" : "john"
}
}
]
},
"query" : {
"text" : {
"_all" : "text"
}
}
}
}
}
'

OK, i see.
My query is:

{
"query" : { "query_string" : {"query" : "u*"} },

"facets" : {
  "my-facet-user" : { "terms" : {"field" : "user"
  , "all_terms" : true

  }

,
"facet_filter" : {
"term" : { "user" : "john"}
}

  }
}

}

But i should filter the query, not the facet :slight_smile:

On Dec 21, 10:45 am, Clinton Gormley cl...@traveljury.com wrote:

Hi John

i´m not sure if i really understand facet_filter. I have a query +
facets + a facet_filter.

Applying the facet_filter only the facet specified is returned. OK.
But i still get all results from the query..

There are numerous places that filters can be applied:

  • to a query (affects facets and results)
  • to a search (affects results but not facets)
  • to a facet (affects facets but not results)

What does my query / query_string look like if i want to show all
tweets by user "john" that contains the string "text" and are tagged
with the color "blue" ?

Your query for the above could look something like this:

curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"and" : [
{
"term" : {
"tag" : "blue"
}
},
{
"term" : {
"user" : "john"
}
}
]
},
"query" : {
"text" : {
"_all" : "text"
}
}
}
}}

'