What's the scope value of Facet?


(Yang) #1

Hi all,

I'm playing ES, but here I meet a problem with facet: I don't know what
value should I pass to field scope of Facet.

http://www.elasticsearch.org/guide/reference/api/search/facets/

The page above just give a little info about scope, and also, I tried value
"index", "type" and "document", but they don't work, no facet value return.
Could anybody show me some reference?

That would be very helpful~~

thanks,

Yang.


(Ivan Brusic) #2

Hi Yang,

A field is any [non-analyzed] field in your document. The facet will
place all the values into buckets and return the relevant results. In
the example on the page you linked to, documents such as the following
are created:

{
"title": "One",
"tags": [
"foo"
]
}

The document contains two fields: title and tags. The latter is
multi-valued (facets work on non-multivalued terms as well, just
pointing out the notation). The facet then is used on the tags field.

Cheers,

Ivan

On Fri, May 4, 2012 at 2:43 AM, Yang yuyang030405@gmail.com wrote:

Hi all,

I'm playing ES, but here I meet a problem with facet: I don't know what
value should I pass to field scope of Facet.

http://www.elasticsearch.org/guide/reference/api/search/facets/

The page above just give a little info about scope, and also, I tried value
"index", "type" and "document", but they don't work, no facet value return.
Could anybody show me some reference?

That would be very helpful~~

thanks,

Yang.


(Yang) #3

Hi Ivan,

Thanks very much, it is really helpful~

I got your point, and I'm trying it, it seems work now.

Again, thanks~~

--
Yang

On Friday, May 4, 2012 11:17:41 PM UTC+8, Ivan Brusic wrote:

Hi Yang,

A field is any [non-analyzed] field in your document. The facet will
place all the values into buckets and return the relevant results. In
the example on the page you linked to, documents such as the following
are created:

{
"title": "One",
"tags": [
"foo"
]
}

The document contains two fields: title and tags. The latter is
multi-valued (facets work on non-multivalued terms as well, just
pointing out the notation). The facet then is used on the tags field.

Cheers,

Ivan

On Fri, May 4, 2012 at 2:43 AM, Yang yuyang030405@gmail.com wrote:

Hi all,

I'm playing ES, but here I meet a problem with facet: I don't know what
value should I pass to field scope of Facet.

http://www.elasticsearch.org/guide/reference/api/search/facets/

The page above just give a little info about scope, and also, I tried
value
"index", "type" and "document", but they don't work, no facet value
return.
Could anybody show me some reference?

That would be very helpful~~

thanks,

Yang.


(system) #4