Multi_field and aggregations

Hi there, it's been a while since I last used es. My last project was based
on 0.9.x branch. I'm new to the new fields and aggregations.

I have a field mapped as a multi_field:

"genre": {
"type": "string",
"store": false,
"index": "analyzed",
"analyzer": "short",
"fields" : {
"raw" : {"type" : "string", "index" : "not_analyzed"}
}

The whole idea is that genre uses a custom analyzer that keeps stop words
(we need some of them on our genre), and I've decided to keep a raw so I
could execute a faceted search on counting genres

But when I try to run:

{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"genre_count": {
"terms": {
"size": 0,
"field": "genre.raw"
}
}
}
}

It fails with no results. What I wanted is to get something like :

Action & Adventure : 100

Adventure: 200

Instead, if I remove the search, the terms are split in such way:

Action : 100

Adventure : 300

What's the proper way to run the aggs query?

Regards

--
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/368240bd-34ac-4a79-b085-17564e512954%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

hum, sorry, noticed that the mapping was not set on that index. works fine
now

On Wednesday, July 16, 2014 2:20:45 PM UTC-4, Vinicius Carvalho wrote:

Hi there, it's been a while since I last used es. My last project was
based on 0.9.x branch. I'm new to the new fields and aggregations.

I have a field mapped as a multi_field:

"genre": {
"type": "string",
"store": false,
"index": "analyzed",
"analyzer": "short",
"fields" : {
"raw" : {"type" : "string", "index" : "not_analyzed"}
}

The whole idea is that genre uses a custom analyzer that keeps stop words
(we need some of them on our genre), and I've decided to keep a raw so I
could execute a faceted search on counting genres

But when I try to run:

{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"genre_count": {
"terms": {
"size": 0,
"field": "genre.raw"
}
}
}
}

It fails with no results. What I wanted is to get something like :

Action & Adventure : 100

Adventure: 200

Instead, if I remove the search, the terms are split in such way:

Action : 100

Adventure : 300

What's the proper way to run the aggs query?

Regards

--
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/c5c6677e-285d-45dd-a33a-42c1776bd8ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.