Named Filters and Faceting

I've been working with ElasticSearch for the last 6 months or so and have been very happy with the features and performance. However, I have run into a problem I'm not sure if ES supports.

I have a web application in which users are creating multiple standing queries (sometimes relatively complicated). I've been converting the queries to named filters and running them with the appropriate ANDs and ORs to create the result set. I can tell which result belongs to which query/filter via the matched_filters field. I would like to add in an ability to facet on the length of the matched_filters array and provide how many times a result matched a query. I can do the calculation within code but it would probably be faster and easier within ES. Can it give me back that info?

Thanks,

Ken

--

Would Filter Facetshttp://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.htmlwork for you?

On Thursday, January 3, 2013 1:07:57 PM UTC-5, Ken Yeatman wrote:

I've been working with ElasticSearch for the last 6 months or so and have
been very happy with the features and performance. However, I have run
into a problem I'm not sure if ES supports.

I have a web application in which users are creating multiple standing
queries (sometimes relatively complicated). I've been converting the
queries to named filters and running them with the appropriate ANDs and ORs
to create the result set. I can tell which result belongs to which
query/filter via the matched_filters field. I would like to add in an
ability to facet on the length of the matched_filters array and provide how
many times a result matched a query. I can do the calculation within code
but it would probably be faster and easier within ES. Can it give me back
that info?

Thanks,

Ken

--

Igor,

Yes, they would and I've been using them for a variety of other tasks. However, I can't seem to get them to reference the generated matched_filters field rather than _source. I haven't had time to dive into the code so I wasn't sure if it was possible or not.

Thanks,
Ken

Ken

On Jan 3, 2013, at 8:01 PM, Igor Motov imotov@gmail.com wrote:

Would Filter Facets work for you?

On Thursday, January 3, 2013 1:07:57 PM UTC-5, Ken Yeatman wrote:
I've been working with ElasticSearch for the last 6 months or so and have been very happy with the features and performance. However, I have run into a problem I'm not sure if ES supports.

I have a web application in which users are creating multiple standing queries (sometimes relatively complicated). I've been converting the queries to named filters and running them with the appropriate ANDs and ORs to create the result set. I can tell which result belongs to which query/filter via the matched_filters field. I would like to add in an ability to facet on the length of the matched_filters array and provide how many times a result matched a query. I can do the calculation within code but it would probably be faster and easier within ES. Can it give me back that info?

Thanks,

Ken

--

--

I don't think you can reference named filters from filter facets but you
can simply repeat filters in the facets instead.

On Thursday, January 3, 2013 8:13:52 PM UTC-5, Ken Yeatman wrote:

Igor,

Yes, they would and I've been using them for a variety of other tasks.
However, I can't seem to get them to reference the generated
matched_filters field rather than _source. I haven't had time to dive into
the code so I wasn't sure if it was possible or not.

Thanks,
Ken

Ken

On Jan 3, 2013, at 8:01 PM, Igor Motov <imo...@gmail.com <javascript:>>
wrote:

Would Filter Facetshttp://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.htmlwork for you?

On Thursday, January 3, 2013 1:07:57 PM UTC-5, Ken Yeatman wrote:

I've been working with ElasticSearch for the last 6 months or so and have
been very happy with the features and performance. However, I have run
into a problem I'm not sure if ES supports.

I have a web application in which users are creating multiple standing
queries (sometimes relatively complicated). I've been converting the
queries to named filters and running them with the appropriate ANDs and ORs
to create the result set. I can tell which result belongs to which
query/filter via the matched_filters field. I would like to add in an
ability to facet on the length of the matched_filters array and provide how
many times a result matched a query. I can do the calculation within code
but it would probably be faster and easier within ES. Can it give me back
that info?

Thanks,

Ken

--

--