My query returns no facets? Any idea?

http://pastebin.ca/2532879

As you can see, I am getting total, took, _shards and hits, but no facets.
What am I doing wrong?

Thank you for your time!

--
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/86a1d8d1-c5a9-4e27-80eb-0a42d7c610aa%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

A few things.

  • I am surprised the response did not return an error. Facets work on the
    document set returned by the query, so it is incorrect to add a query
    section to the facet. Try it again without the query.

  • Did you really use a JSON with a "body" section?

  • The fields parameter does not form part of the query, but part of the
    request.

Try something like:

{
"query": {
"match_all": {}
},
"fields": [
"title"
],
"facets": {
"company": {
"terms": {
"field": "locations"
}
}
}
}

On Fri, Jan 10, 2014 at 8:24 AM, georgi.mateev@jobvector.com wrote:

http://pastebin.ca/2532879

As you can see, I am getting total, took, _shards and hits, but no facets.
What am I doing wrong?

Thank you for your time!

--
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/86a1d8d1-c5a9-4e27-80eb-0a42d7c610aa%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%3DcQC_SWBgYfMSTC5gw0KrKhF3p7q%3DrRE4B_8S-gvHZwLwNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

I did the following request now:

{
"query": {
"match_all": {}
},
"facets": {
"company": {
"terms": {
"field": "locations",
"all_terms": true
}
}
}
}

And I got exactly the same response :frowning:

Am Freitag, 10. Januar 2014 17:37:20 UTC+1 schrieb Ivan Brusic:

A few things.

  • I am surprised the response did not return an error. Facets work on the
    document set returned by the query, so it is incorrect to add a query
    section to the facet. Try it again without the query.

  • Did you really use a JSON with a "body" section?

  • The fields parameter does not form part of the query, but part of the
    request.

Try something like:

{
"query": {
"match_all": {}
},
"fields": [
"title"
],
"facets": {
"company": {
"terms": {
"field": "locations"
}
}
}
}

On Fri, Jan 10, 2014 at 8:24 AM, <georgi...@jobvector.com <javascript:>>wrote:

http://pastebin.ca/2532879

As you can see, I am getting total, took, _shards and hits, but no
facets. What am I doing wrong?

Thank you for your time!

--
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/86a1d8d1-c5a9-4e27-80eb-0a42d7c610aa%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/24d42cc9-4f56-41c0-a18f-236bee7538ff%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

There is no error in the request, the HEAD plugin just doesn't show the
facets ... If I do the request with CURL I get the facets

Am Freitag, 10. Januar 2014 17:24:31 UTC+1 schrieb georgi...@jobvector.com:

http://pastebin.ca/2532879

As you can see, I am getting total, took, _shards and hits, but no facets.
What am I doing wrong?

Thank you for your time!

--
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/50701c11-8883-4c66-9c41-f5562d3dd4ec%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Here's an example of a facet query, complete with the results of
post-processing it as a hierarchical combination facet (not yet available
in ES 0.90.X). The script is used to provide the response in such a way
that I can easily break it down into a hierarchical combination of
arbitrary depth. In this example, it shows the top ten words used in cities
in the USA and Puerto Rico by state.

First, the full query, including the facet. It was issued against
approximately 26K documents within a type that contains all cities in the
US and Puerto Rico (originally from the US Census). That's why the
match_all with no additional filtering is used. The query was built using
the Java API, and the JSON below was emitted by the Java API:

{
"from" : 0,
"size" : 50000,
"timeout" : 60000,
"query" : {
"match_all" : { }
},
"version" : true,
"explain" : false,
"fields" : [ "_ttl", "_source" ],
"facets" : {
"state_city_combinations" : {
"terms" : {
"size" : 10,
"script" : "doc['state'].value + "~~~" + doc['city'].value"
}
}
}
}

The response. The "terms" JSON object is what ElasticSearch returned, while
the "combinations" is what I calculated by processing what ElasticSearch
returned. Just as a point of interest:

{
"facets" : {
"state_city_combinations" : {
"_type" : "terms",
"total" : 25376,
"other" : 25123,
"missing" : 0,
"combinations" : {
"fl" : {
"beach" : 61,
"lake" : 18,
"citi" : 13
},
"mo" : {
"citi" : 36
},
"tx" : {
"citi" : 33
},
"il" : {
"citi" : 22
},
"ny" : {
"east" : 21
},
"mn" : {
"lake" : 19
},
"wi" : {
"lake" : 16
},
"ia" : {
"citi" : 14
}
},
"terms" : [ {
"term" : "fl~beach",
"count" : 61
}, {
"term" : "mo
~citi",
"count" : 36
}, {
"term" : "tx~citi",
"count" : 33
}, {
"term" : "il
~citi",
"count" : 22
}, {
"term" : "ny~east",
"count" : 21
}, {
"term" : "mn
~lake",
"count" : 19
}, {
"term" : "fl~lake",
"count" : 18
}, {
"term" : "wi
~lake",
"count" : 16
}, {
"term" : "ia~citi",
"count" : 14
}, {
"term" : "fl
~citi",
"count" : 13
} ]
}
}
}

Brian

--
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/a4e90cd6-3785-498e-a1fe-a3b1acca2ba9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.