Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when field index turned off with scaled_float type #23487

Closed
tegyud opened this issue Mar 5, 2017 · 0 comments · Fixed by #23528
Closed

NPE when field index turned off with scaled_float type #23487

tegyud opened this issue Mar 5, 2017 · 0 comments · Fixed by #23528

Comments

@tegyud
Copy link

tegyud commented Mar 5, 2017

Elasticsearch version: 5.2.2
Plugins installed: []
JVM version: openjdk 1.8.0_121
OS version: Ubuntu 16.04

Description of the problem:
Turned off the indexing of one scaled_float field in my mapping and in Kibana the index pattern broke after refreshing the fields.
The result of it in Discover view are these errors: Saved "field" parameter is now invalid. Please select a new field. Discover: "field" is a required parameter.
But the underlying problem is a null pointer exception.

Steps to reproduce:

  1. Create an index template mapping with at least one property like this:
"price": {
  "type": "scaled_float",
  "scaling_factor": 100000,
  "index": false
}
  • I also set "index.mapper.dynamic" to false in the template settings, but don't think it's required here. I also have a date field.
  1. Index a document using the template.
  2. Try to refresh the field list of the index pattern in Kibana or create a new one. None of the fields will be selected as searchable or aggregatable.
  3. Discover view will instantly show the errors.
  4. Check the elasticsearch log for a NPE.

Changing the type to float or double works, and also leaving the index option on default true eliminates the problem, but I really need both index off and scaled_float type.

Logs:

[2017-03-05T01:50:43,410][DEBUG][o.e.a.f.TransportFieldStatsAction] [nody] [algo-2017.03.05][0], node[NyXkT85sSHei6koqdsNq-g], [P], s[STARTED], a[id=yYv-Du-QSDec1-Qs4t1IQA]: failed to execute [org.elasticsearch.action.fieldstats.FieldStatsRequest@6bc02255]
org.elasticsearch.transport.RemoteTransportException: [nody][192.168.0.4:9300][indices:data/read/field_stats[s]]
Caused by: org.elasticsearch.ElasticsearchException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at org.elasticsearch.ExceptionsHelper.convertToElastic(ExceptionsHelper.java:55) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:202) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:55) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:301) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:297) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) [elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) [elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.2.2.jar:5.2.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:401) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:116) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1195) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.getFieldStats(IndicesService.java:1152) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:196) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:55) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:301) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:297) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.2.2.jar:5.2.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_121]
Caused by: java.lang.NullPointerException
        at org.elasticsearch.index.mapper.ScaledFloatFieldMapper$ScaledFloatFieldType.stats(ScaledFloatFieldMapper.java:271) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.lambda$getFieldStats$17(IndicesService.java:1154) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$18(IndicesService.java:1189) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:160) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:143) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:398) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:116) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1195) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.indices.IndicesService.getFieldStats(IndicesService.java:1152) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:196) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:55) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:301) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:297) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) ~[elasticsearch-5.2.2.jar:5.2.2]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.2.2.jar:5.2.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_121]
rjernst added a commit to rjernst/elasticsearch that referenced this issue Mar 10, 2017
This fixes an NPE in finding scaled float stats. The type of min/max
methods on the wrapped long stats returns a boxed type, but in the case
this is null, the unbox done for the FieldStats.Double ctor primitive
types will cause the NPE. These methods would have null for min/max when
the field exists, but does not actually have points values.

fixes elastic#23487
rjernst added a commit that referenced this issue Mar 15, 2017
…23528)

This fixes an NPE in finding scaled float stats. The type of min/max
methods on the wrapped long stats returns a boxed type, but in the case
this is null, the unbox done for the FieldStats.Double ctor primitive
types will cause the NPE. These methods would have null for min/max when
the field exists, but does not actually have points values.

fixes #23487
rjernst added a commit that referenced this issue Mar 15, 2017
…23528)

This fixes an NPE in finding scaled float stats. The type of min/max
methods on the wrapped long stats returns a boxed type, but in the case
this is null, the unbox done for the FieldStats.Double ctor primitive
types will cause the NPE. These methods would have null for min/max when
the field exists, but does not actually have points values.

fixes #23487
rjernst added a commit that referenced this issue Mar 15, 2017
…23528)

This fixes an NPE in finding scaled float stats. The type of min/max
methods on the wrapped long stats returns a boxed type, but in the case
this is null, the unbox done for the FieldStats.Double ctor primitive
types will cause the NPE. These methods would have null for min/max when
the field exists, but does not actually have points values.

fixes #23487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant