Return docID instead of count in facets when count=1

Heya,

I would like to create a new feature (pull request on existing code or plugin) and here is my use case:

Say I have 3 docs :
id:1, color:red
id:2, color:red
id:3, color:yellow

If I run a MatchAllQuery with a TermFacet, I'll probably get:
myfacet:
term: red, count: 2
term: yellow, count: 1

When my count is a very tiny number (say 1), I would like to get back their ids:
myfacet:
term: red, count: 2
term: yellow, count: 1, ids:[1]

First: can I achieve this? Where can I start to hack ES code to code this.
I was thinking of modifying TermsFacetBuilder to add an option (let's say idthreshold) but where should I use it after that?
Is it a bad idea to think it as a facet feature?

Thanks for your insights.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

Hi there,

Anyone has an idea about my use case?
Is there any way to do it?

Thanks for any help (even if it's "you can not do it")
David.

Le mardi 13 novembre 2012 17:47:40 UTC+1, David Pilato a écrit :

Heya,

I would like to create a new feature (pull request on existing code or
plugin) and here is my use case:

Say I have 3 docs :
id:1, color:red
id:2, color:red
id:3, color:yellow

If I run a MatchAllQuery with a TermFacet, I'll probably get:
myfacet:
term: red, count: 2
term: yellow, count: 1

When my count is a very tiny number (say 1), I would like to get back
their ids:
myfacet:
term: red, count: 2
term: yellow, count: 1, ids:[1]

First: can I achieve this? Where can I start to hack ES code to code this.
I was thinking of modifying TermsFacetBuilder to add an option (let's say
idthreshold) but where should I use it after that?
Is it a bad idea to think it as a facet feature?

Thanks for your insights.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

I would assume that the problem would be is that the reduce phase works
over a map of keys and counts. You would need to pass around different a
different, more complex data structure, between the nodes/shards.

--
Ivan

On Mon, Nov 26, 2012 at 3:54 AM, David Pilato david@pilato.fr wrote:

Hi there,

Anyone has an idea about my use case?
Is there any way to do it?

Thanks for any help (even if it's "you can not do it")
David.

Le mardi 13 novembre 2012 17:47:40 UTC+1, David Pilato a écrit :

Heya,

I would like to create a new feature (pull request on existing code or
plugin) and here is my use case:

Say I have 3 docs :
id:1, color:red
id:2, color:red
id:3, color:yellow

If I run a MatchAllQuery with a TermFacet, I'll probably get:
myfacet:
term: red, count: 2
term: yellow, count: 1

When my count is a very tiny number (say 1), I would like to get back
their ids:
myfacet:
term: red, count: 2
term: yellow, count: 1, ids:[1]

First: can I achieve this? Where can I start to hack ES code to code
this.
I was thinking of modifying TermsFacetBuilder to add an option (let's say
idthreshold) but where should I use it after that?
Is it a bad idea to think it as a facet feature?

Thanks for your insights.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

Hi ,

This is one feature i also would love to see.

Kindly comment on how to create a plugin for this purpose.

Thanks
Vineeth

On Monday, November 26, 2012 10:23:50 PM UTC+5:30, Ivan Brusic wrote:

I would assume that the problem would be is that the reduce phase works
over a map of keys and counts. You would need to pass around different a
different, more complex data structure, between the nodes/shards.

--
Ivan

On Mon, Nov 26, 2012 at 3:54 AM, David Pilato <da...@pilato.fr<javascript:>

wrote:

Hi there,

Anyone has an idea about my use case?
Is there any way to do it?

Thanks for any help (even if it's "you can not do it")
David.

Le mardi 13 novembre 2012 17:47:40 UTC+1, David Pilato a écrit :

Heya,

I would like to create a new feature (pull request on existing code or
plugin) and here is my use case:

Say I have 3 docs :
id:1, color:red
id:2, color:red
id:3, color:yellow

If I run a MatchAllQuery with a TermFacet, I'll probably get:
myfacet:
term: red, count: 2
term: yellow, count: 1

When my count is a very tiny number (say 1), I would like to get back
their ids:
myfacet:
term: red, count: 2
term: yellow, count: 1, ids:[1]

First: can I achieve this? Where can I start to hack ES code to code
this.
I was thinking of modifying TermsFacetBuilder to add an option (let's
say idthreshold) but where should I use it after that?
Is it a bad idea to think it as a facet feature?

Thanks for your insights.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

--

For processing doc ids on the faceting level, the same prerequisites as for
grouping results need to be implemented. I'm confident, after Lucene 4
migration, changes to the faceting framework will enable fast multi-shard
grouping and similar operations, also on plugin level.

For now, it's a big challenge, and must be patched into main codebase. No
plugin hooks yet, afaik.

Jörg

--