Question about value_count aggregation

Hi All,

I'm having trouble with a value_count aggregation that uses a script. For
context I have an index of 100,000 dummy documents all with 1-word titles.

My query looks like:

{
"query": {
"match_all": {}
},
"filter": {
"match_all": {}
},
"aggs": {
"category_tokens": {
"value_count": {
"script": "doc['title'].values.size() > 1"
}
}
}

But I get an error like: 'CompileException[[Error: No field found for
[org.elasticsearch.index.fielddata.ScriptDocValues$Strings@1cdd34b3]'.

If it helps my mapping looks like:

"title": {
"type": "string"
}

What am I doing wrong here? Is it not possible to use a script like this?

--
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/8ab1b50d-ae91-4a2f-b92e-cb5ebcf9ca02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Sam ,

The title field , i presume is a single value field which means values will
fail.
You need to use something like

doc['title'].value.length > 1

Thanks
Vineeth

On Wed, Sep 17, 2014 at 9:11 PM, Sam Chrisinger s.chrisinger@gmail.com
wrote:

Hi All,

I'm having trouble with a value_count aggregation that uses a script. For
context I have an index of 100,000 dummy documents all with 1-word titles.

My query looks like:

{
"query": {
"match_all": {}
},
"filter": {
"match_all": {}
},
"aggs": {
"category_tokens": {
"value_count": {
"script": "doc['title'].values.size() > 1"
}
}
}

But I get an error like: 'CompileException[[Error: No field found for
[org.elasticsearch.index.fielddata.ScriptDocValues$Strings@1cdd34b3]'.

If it helps my mapping looks like:

"title": {
"type": "string"
}

What am I doing wrong here? Is it not possible to use a script like this?

--
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/8ab1b50d-ae91-4a2f-b92e-cb5ebcf9ca02%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/8ab1b50d-ae91-4a2f-b92e-cb5ebcf9ca02%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAGdPd5neKgF1yEYiq2Ce6UWBv1TeptP125D_bvi8S6FUGSPUZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.