Facet_filters, es 0.16.2


(vinny) #1

I'm trying to get facet_filters working and I seem to be stuck. Here
is my test:

{
"query":{
"match_all":{}
},
"facets":{
"tag":{
"terms":{
"field":"file_stages_filetype_result_extension"
}
},
"facet_filter":{
"terms":{
"file_stages_filetype_result_extension":["txt",
"htm"
]
}
}
}
}

If I remove the facet_filter it works fine and shows me all of the
facet data for that fields. The exception I get is here:
Failed to execute
[org.elasticsearch.action.search.SearchRequest@17a8b43]
org.elasticsearch.search.SearchParseException:
[96b46884fdddbf5b95a0568d84638da9][1]:
query[ConstantScore(:)],from[-1],size[-1]: Parse Failure [Failed to
parse source [{"query":{"match_all":{}},"facets":{"tag":{"terms":
{"field":"file_stages_filetype_result_extension"}},"facet_filter":
{"terms":{"file_stages_filetype_result_extension":["txt","htm"]}}}}]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:
473)

I have also tried to get an and filter working with my facet_filter
and that doesn't seem to work either. The filters do work in a
standalone query filter just not with the facet_filter.

thanks,
Vinny


(Hari Shankar) #2

Hi Vinny,

Try this:

{
"query":{
"match_all":{}
},
"facets":{
"tag":{
"terms":{
"field":"file_stages_filetype_result_extension"
},
"facet_filter":{
"terms":{
"file_stages_filetype_result_extension":["txt",
"htm"
]
}
}
}
}
}

Facet filter is a property of the specific facet so it should come within
the facet.

Hari

On Sat, Jul 2, 2011 at 2:41 AM, vinny agnellvj@gmail.com wrote:

I'm trying to get facet_filters working and I seem to be stuck. Here
is my test:

{
"query":{
"match_all":{}
},
"facets":{
"tag":{
"terms":{
"field":"file_stages_filetype_result_extension"
}
},
"facet_filter":{
"terms":{
"file_stages_filetype_result_extension":["txt",
"htm"
]
}
}
}
}

If I remove the facet_filter it works fine and shows me all of the
facet data for that fields. The exception I get is here:
Failed to execute
[org.elasticsearch.action.search.SearchRequest@17a8b43]
org.elasticsearch.search.SearchParseException:
[96b46884fdddbf5b95a0568d84638da9][1]:
query[ConstantScore(:)],from[-1],size[-1]: Parse Failure [Failed to
parse source [{"query":{"match_all":{}},"facets":{"tag":{"terms":
{"field":"file_stages_filetype_result_extension"}},"facet_filter":
{"terms":{"file_stages_filetype_result_extension":["txt","htm"]}}}}]]
at
org.elasticsearch.search.SearchService.parseSource(SearchService.java:
473)

I have also tried to get an and filter working with my facet_filter
and that doesn't seem to work either. The filters do work in a
standalone query filter just not with the facet_filter.

thanks,
Vinny


(vinny) #3

Thanks, that's what it was. I didn't realize I was one level outside
of what I should have been. I blame to many curly braces.

On Jul 2, 12:22 am, Hari Shankar shaan.h...@gmail.com wrote:

Hi Vinny,

Try this:

{
"query":{
"match_all":{}
},
"facets":{
"tag":{
"terms":{
"field":"file_stages_filetype_result_extension"
},
"facet_filter":{
"terms":{
"file_stages_filetype_result_extension":["txt",
"htm"
]
}
}
}
}

}

Facet filter is a property of the specific facet so it should come within
the facet.

Hari


(system) #4