ExpressionScriptCompilationException[Field [<field name>] used in expression does not exist in mappings];

Hi there,
We're just getting started with ELK and are using:
Elasticsearch 1.4.4
Kibana 4.0
on
Ubuntu 14.04

We needed to create a scripted field to calculate the ratio between two
numeric fields. These fields are not on all events and only started
appearing at all a day ago (so older indexes don't have it at all).
name: ads_per_page
script: doc['ads_found'].value / max(1, doc['pages_parsed'].value)

It seemed to be working great at first but now Kibana has been resurfacing
these elasticsearch errors constantly and I can't seem to find any
information about it online (too new?).
This repeats for every shard as far as I can tell (there are about 2 weeks
of indexes there. Any suggestions would be appreciated.
Shard Failures

The following shard failures ocurred:

  • Index: logstash-2015.02.21 Shard: 0 Reason: SearchParseException[[logstash-2015.02.21][0]:
    query[ConstantScore(BooleanFilter(+cache(@timestamp:[1425571563220 TO
    1425657963220])))],from[-1],size[500],sort[<custom:"@timestamp":
    org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@4c1942d3>!]:
    Parse Failure [Failed to parse source
    [{"size":500,"sort":{"@timestamp":"desc"},"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1425571563220,"lte":1425657963220}}}],"must_not":[]}}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"":{}}},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"30m","pre_zone":"-08:00","pre_zone_adjust_large_interval":true,"min_doc_count":0,"extended_bounds":{"min":1425571563220,"max":1425657963220}}}},"fields":["*","_source"],"script_fields":{"ads_per_page":{"script":"doc['ads_found'].value
    / max(1,
    doc['pages_parsed'].value)","lang":"expression"}},"fielddata_fields":["@timestamp"]}]]];
    nested: ExpressionScriptCompilationException[Field [ads_found] used in
    expression does not exist in mappings];

--
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/971bfbf2-6210-473b-9098-6262ed302846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

It looks like the same question (but with more context/information)
here: elasticsearch - Expressions with dynamicly generated schemas throw exceptions when some indices have different mapping - Stack Overflow
but doesn't have any answers yet either.

Does anyone here happen to know what the best practice way of addressing
these indices without the mapping in question? I'd really hate to have to
go through and hand update them all to have the mapping :frowning:

On Friday, March 6, 2015 at 8:27:48 AM UTC-8, Alex Schokking wrote:

Hi there,
We're just getting started with ELK and are using:
Elasticsearch 1.4.4
Kibana 4.0
on
Ubuntu 14.04

We needed to create a scripted field to calculate the ratio between two
numeric fields. These fields are not on all events and only started
appearing at all a day ago (so older indexes don't have it at all).
name: ads_per_page
script: doc['ads_found'].value / max(1, doc['pages_parsed'].value)

It seemed to be working great at first but now Kibana has been resurfacing
these elasticsearch errors constantly and I can't seem to find any
information about it online (too new?).
This repeats for every shard as far as I can tell (there are about 2 weeks
of indexes there. Any suggestions would be appreciated.
Shard Failures

The following shard failures ocurred:

  • Index: logstash-2015.02.21 Shard: 0 Reason: SearchParseException[[logstash-2015.02.21][0]:
    query[ConstantScore(BooleanFilter(+cache(@timestamp:[1425571563220 TO
    1425657963220])))],from[-1],size[500],sort[<custom:"@timestamp":
    org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@4c1942d3>!]:
    Parse Failure [Failed to parse source
    [{"size":500,"sort":{"@timestamp":"desc"},"query":{"filtered":{"query":{"query_string":{"analyze_wildcard":true,"query":""}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"gte":1425571563220,"lte":1425657963220}}}],"must_not":[]}}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"":{}}},"aggs":{"2":{"date_histogram":{"field":"@timestamp","interval":"30m","pre_zone":"-08:00","pre_zone_adjust_large_interval":true,"min_doc_count":0,"extended_bounds":{"min":1425571563220,"max":1425657963220}}}},"fields":["*","_source"],"script_fields":{"ads_per_page":{"script":"doc['ads_found'].value
    / max(1,
    doc['pages_parsed'].value)","lang":"expression"}},"fielddata_fields":["@timestamp"]}]]];
    nested: ExpressionScriptCompilationException[Field [ads_found] used in
    expression does not exist in mappings];

--
Please update your bookmarks! We have moved to https://discuss.elastic.co/

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/db5d1ac5-0961-4274-b329-00832834340e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

1 Like

We just started seeing this today. No idea why nor how to fix it. Kibana does not work at all with logstash-* indices now.