Terms facet on single field but also return associated id


(Vincent van der walt) #1

Hi,

I'm wondering if anyone could help me.

We're doing a terms facet on a field which works fine. However I'm trying
to also return the corresponding id of that field so I can provide click
through functionality on my grid.

eg index = fieldid,fieldname

if I do a termsfacet I get

field1 10
field2 34
field3 50

but I'd like to return the id too rather than do another search and merge (
very inefficient since I'm dealing with large amounts of data). Composite
fields won't work for us since I'll have to constantly rebuild the index.
the terms I'm using can be very dynamic.

Is this possible ?

Thanks

Vinny

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4317dae0-690b-4205-a5f7-ea8e5908661d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

I am not sure I can follow your requirement. Cam you describe what you
actually mean with an associated id? What is it associated with? A
document? An index?

If you want to get the document ids, which actually were part of a facet
bucket, this is not possible with facets and you might need to execute
another query.

--Alex

On Thu, Jan 9, 2014 at 11:55 AM, Vincent van der walt <
vincent.vanderwalt@gmail.com> wrote:

Hi,

I'm wondering if anyone could help me.

We're doing a terms facet on a field which works fine. However I'm trying
to also return the corresponding id of that field so I can provide click
through functionality on my grid.

eg index = fieldid,fieldname

if I do a termsfacet I get

field1 10
field2 34
field3 50

but I'd like to return the id too rather than do another search and merge
( very inefficient since I'm dealing with large amounts of data). Composite
fields won't work for us since I'll have to constantly rebuild the index.
the terms I'm using can be very dynamic.

Is this possible ?

Thanks

Vinny

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/4317dae0-690b-4205-a5f7-ea8e5908661d%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-bjrdmxRgB-kZWg6Yk82HVKgvAa4ax_Cz7uZdiCGbBDA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Vincent van der walt) #3

Hi Alex

It's not the document id. There's 2 fields in the row for example

vinny, viking
alexander, great

I would like to get the results for the terms facet and another field in
the row

eg.

viking 1 (I also need vinny)
great 1 (I also need alexander)

Does this makes sense ?

Vinny

On Tuesday, 14 January 2014 11:13:31 UTC, Alexander Reelsen wrote:

Hey,

I am not sure I can follow your requirement. Cam you describe what you
actually mean with an associated id? What is it associated with? A
document? An index?

If you want to get the document ids, which actually were part of a facet
bucket, this is not possible with facets and you might need to execute
another query.

--Alex

On Thu, Jan 9, 2014 at 11:55 AM, Vincent van der walt <
vincent.v...@gmail.com <javascript:>> wrote:

Hi,

I'm wondering if anyone could help me.

We're doing a terms facet on a field which works fine. However I'm trying
to also return the corresponding id of that field so I can provide click
through functionality on my grid.

eg index = fieldid,fieldname

if I do a termsfacet I get

field1 10
field2 34
field3 50

but I'd like to return the id too rather than do another search and merge
( very inefficient since I'm dealing with large amounts of data). Composite
fields won't work for us since I'll have to constantly rebuild the index.
the terms I'm using can be very dynamic.

Is this possible ?

Thanks

Vinny

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/4317dae0-690b-4205-a5f7-ea8e5908661d%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4f85c81c-c2c1-47c5-8dd8-c2894223f905%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #4

Just to clarify, when you say "there's 2 fields in the row", do you really
mean that the field has two values (an array)? If so, the facet results
should look like:

alexander 1
great 1
viking 1
vinny 1

There is no easy way to achieve what you want. One way would be to great
combined keys during your indexing process and create a new field to be
faceted on. The values would be someting like alexander|great and
viking|vinny. You would then need to process the results on the client side
after your query.

What you perhaps really looking for is field collapsing, which is not yet
supported. The elasticsearch team said it would be post 1.0.

Cheers,

Ivan

On Tue, Jan 14, 2014 at 4:39 AM, Vincent van der walt <
vincent.vanderwalt@gmail.com> wrote:

Hi Alex

It's not the document id. There's 2 fields in the row for example

vinny, viking
alexander, great

I would like to get the results for the terms facet and another field in
the row

eg.

viking 1 (I also need vinny)
great 1 (I also need alexander)

Does this makes sense ?

Vinny

On Tuesday, 14 January 2014 11:13:31 UTC, Alexander Reelsen wrote:

Hey,

I am not sure I can follow your requirement. Cam you describe what you
actually mean with an associated id? What is it associated with? A
document? An index?

If you want to get the document ids, which actually were part of a facet
bucket, this is not possible with facets and you might need to execute
another query.

--Alex

On Thu, Jan 9, 2014 at 11:55 AM, Vincent van der walt <
vincent.v...@gmail.com> wrote:

Hi,

I'm wondering if anyone could help me.

We're doing a terms facet on a field which works fine. However I'm
trying to also return the corresponding id of that field so I can provide
click through functionality on my grid.

eg index = fieldid,fieldname

if I do a termsfacet I get

field1 10
field2 34
field3 50

but I'd like to return the id too rather than do another search and
merge ( very inefficient since I'm dealing with large amounts of data).
Composite fields won't work for us since I'll have to constantly rebuild
the index. the terms I'm using can be very dynamic.

Is this possible ?

Thanks

Vinny

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/4317dae0-690b-4205-a5f7-ea8e5908661d%
40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/4f85c81c-c2c1-47c5-8dd8-c2894223f905%40googlegroups.com
.

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQAzCUsg7Jo60XdmOq1%3DiEtTkXeFOH8FmFBOt26HD%2Bf4Fg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5