Facet in Array Field


(vibin) #1

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--


(David Pilato) #2

How did you apply your filter on facet? Could you gist your case?

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

Le 23 août 2012 à 19:59, vibin vibindhas@gmail.com a écrit :

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--

--


(vibin) #3

Hi Pilato,

I have uploaded my case in gist

Thanks,
-Vibin

On Thursday, August 23, 2012 11:32:58 PM UTC+5:30, David Pilato wrote:

How did you apply your filter on facet? Could you gist your case?

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

Le 23 août 2012 à 19:59, vibin <vibi...@gmail.com <javascript:>> a écrit :

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--

--


(David Pilato) #4

When you gist a case, it should be complete as anybody can reproduce it in some
minutes.
See help guide here: http://www.elasticsearch.org/help/
http://www.elasticsearch.org/help/

That said, I'm wondering if you are not looking for filter facet:
http://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.html
http://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.html

It's hard to understand your you use case without indexed documents.

David.

Le 3 septembre 2012 à 07:08, vibin vibindhas@gmail.com a écrit :

Hi Pilato,

I have uploaded my case in gist

https://gist.github.com/3606794

Thanks,
-Vibin

On Thursday, August 23, 2012 11:32:58 PM UTC+5:30, David Pilato wrote:

How did you apply your filter on facet? Could you gist your case?

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

Le 23 août 2012 à 19:59, vibin < vibi...@gmail.com> a écrit :

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet

result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--


(Suraj) #5

Hi Guys,

I have the same kind of problem. I have a gist which you guys can have look:

// Results:
facets: {
participating-org.name: {
_type: "terms"
missing: 0
total: 8
other: 0
terms: [
{
term: "def"
count: 4
}
{
term: "abc"
count: 4
}
]
}
}

Actually, here the "def" participating-org has "leading" role. I don't know
why there is count for "abc" participating-org too which is not in
"leading" role.

Do you guys have any suggestions? Is it my mappings or the query problems?

Cheers!
Suraj

On Thursday, August 23, 2012 11:44:45 PM UTC+5:45, vibin wrote:

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--


(sujoysett) #6

Hi,

U probably need to use filter within facet.

curl -XPOST 'localhost:9200/org/_search?pretty=true' -d '{
"size": 0,
"facets": {
"organization_facets": {
"terms": {
"field": "participating-org.name"
},
"filter": {
"term": {
"participating-org.role": "leading"
}
}
}
}
}'

-Sujoy.

On Monday, September 3, 2012 2:02:15 PM UTC+5:30, Suraj Tamang wrote:

Hi Guys,

I have the same kind of problem. I have a gist which you guys can have
look:

https://gist.github.com/3607876

// Results:
facets: {
participating-org.name: {
_type: "terms"
missing: 0
total: 8
other: 0
terms: [
{
term: "def"
count: 4
}
{
term: "abc"
count: 4
}
]
}
}

Actually, here the "def" participating-org has "leading" role. I don't
know why there is count for "abc" participating-org too which is not in
"leading" role.

Do you guys have any suggestions? Is it my mappings or the query problems?

Cheers!
Suraj

On Thursday, August 23, 2012 11:44:45 PM UTC+5:45, vibin wrote:

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--


(Suraj) #7

Hi Sujoy,

I have done exactly what you have written, but again, it does not give the
participating-org.name with facet counts. If there is anything missing, you
can add it.

#suraz

On Monday, September 3, 2012 4:55:25 PM UTC+5:45, Sujoy Sett wrote:

Hi,

U probably need to use filter within facet.

curl -XPOST 'localhost:9200/org/_search?pretty=true' -d '{
"size": 0,
"facets": {
"organization_facets": {
"terms": {
"field": "participating-org.name"
},
"filter": {
"term": {
"participating-org.role": "leading"
}
}
}
}
}'

-Sujoy.

On Monday, September 3, 2012 2:02:15 PM UTC+5:30, Suraj Tamang wrote:

Hi Guys,

I have the same kind of problem. I have a gist which you guys can have
look:

https://gist.github.com/3607876

// Results:
facets: {
participating-org.name: {
_type: "terms"
missing: 0
total: 8
other: 0
terms: [
{
term: "def"
count: 4
}
{
term: "abc"
count: 4
}
]
}
}

Actually, here the "def" participating-org has "leading" role. I don't
know why there is count for "abc" participating-org too which is not in
"leading" role.

Do you guys have any suggestions? Is it my mappings or the query problems?

Cheers!
Suraj

On Thursday, August 23, 2012 11:44:45 PM UTC+5:45, vibin wrote:

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--


(Suraj) #8

Hi everyone,

I got my answer from stackoverflow post:

And My Complete Gist with Solution: https://gist.github.com/3616612

#suraz

On Monday, September 3, 2012 10:06:21 PM UTC+5:45, Suraj Tamang wrote:

Hi Sujoy,

I have done exactly what you have written, but again, it does not give the
participating-org.name with facet counts. If there is anything missing,
you can add it.

#suraz

On Monday, September 3, 2012 4:55:25 PM UTC+5:45, Sujoy Sett wrote:

Hi,

U probably need to use filter within facet.

curl -XPOST 'localhost:9200/org/_search?pretty=true' -d '{
"size": 0,
"facets": {
"organization_facets": {
"terms": {
"field": "participating-org.name"
},
"filter": {
"term": {
"participating-org.role": "leading"
}
}
}
}
}'

-Sujoy.

On Monday, September 3, 2012 2:02:15 PM UTC+5:30, Suraj Tamang wrote:

Hi Guys,

I have the same kind of problem. I have a gist which you guys can have
look:

https://gist.github.com/3607876

// Results:
facets: {
participating-org.name: {
_type: "terms"
missing: 0
total: 8
other: 0
terms: [
{
term: "def"
count: 4
}
{
term: "abc"
count: 4
}
]
}
}

Actually, here the "def" participating-org has "leading" role. I don't
know why there is count for "abc" participating-org too which is not in
"leading" role.

Do you guys have any suggestions? Is it my mappings or the query
problems?

Cheers!
Suraj

On Thursday, August 23, 2012 11:44:45 PM UTC+5:45, vibin wrote:

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to select
facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--


(Mandar Rahurkar) #9

I tried executing this example from google which an user was able to run:


However, my output was:

https://gist.github.com/rahurkar/10231685

with no output for facets.

Did this functionality break or change from what's described in the
documentation?

-Mandar

On Monday, September 3, 2012 9:44:18 PM UTC-7, suraz wrote:

Hi everyone,

I got my answer from stackoverflow post:
http://stackoverflow.com/questions/8507489/i-cant-seem-to-get-faceted-search-working-in-elastic-search

And My Complete Gist with Solution: https://gist.github.com/3616612

#suraz

On Monday, September 3, 2012 10:06:21 PM UTC+5:45, Suraj Tamang wrote:

Hi Sujoy,

I have done exactly what you have written, but again, it does not give
the participating-org.name with facet counts. If there is anything
missing, you can add it.

#suraz

On Monday, September 3, 2012 4:55:25 PM UTC+5:45, Sujoy Sett wrote:

Hi,

U probably need to use filter within facet.

curl -XPOST 'localhost:9200/org/_search?pretty=true' -d '{
"size": 0,
"facets": {
"organization_facets": {
"terms": {
"field": "participating-org.name"
},
"filter": {
"term": {
"participating-org.role": "leading"
}
}
}
}
}'

-Sujoy.

On Monday, September 3, 2012 2:02:15 PM UTC+5:30, Suraj Tamang wrote:

Hi Guys,

I have the same kind of problem. I have a gist which you guys can have
look:

https://gist.github.com/3607876

// Results:
facets: {
participating-org.name: {
_type: "terms"
missing: 0
total: 8
other: 0
terms: [
{
term: "def"
count: 4
}
{
term: "abc"
count: 4
}
]
}
}

Actually, here the "def" participating-org has "leading" role. I don't
know why there is count for "abc" participating-org too which is not in
"leading" role.

Do you guys have any suggestions? Is it my mappings or the query
problems?

Cheers!
Suraj

On Thursday, August 23, 2012 11:44:45 PM UTC+5:45, vibin wrote:

Hi All,

I am using ElasticSearch v19.1, I am not able to get the exact facet
result in array field faceting, for Example.

I have an Array Field with values say,

array ["aaa","bbb","ccc"] - is a not analyzed field

When applying Facet for this field with term filter as "aaa" (to
select facet for 'aaa'), I am getting the following result

aaa - count 1

bbb - count 1

ccc - count 1

I am expecting result as

aaa - count 1

Is it how the facet in Array field works?

Can any one help me on this issue?

Thanks,
-Vibin

--
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/e35df782-4414-499f-a7fa-9c2ccf1acacb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #10