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

Range types causing `GetFieldMappingsIndexRequest` to fail due to `NullPointerException` in `RangeFieldMapper.doXContentBody` when `include_defaults=true` is on the query string #22925

Closed
Nysosis opened this issue Feb 2, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@Nysosis
Copy link

commented Feb 2, 2017

Elasticsearch version:

  "version" : {
    "number" : "5.2.0",
    "build_hash" : "24e05b9",
    "build_date" : "2017-01-24T19:52:35.800Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.0"
  }

Plugins installed:
None (Unless Kibana is considered a plugin, in which case Kibana v5.2.0)

JVM version:

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-3~12.04-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

OS version:
Vagrant VM running the hashicorp/precise64 image - A standard Ubuntu 12.04 LTS 64-bit box.

Description of the problem including expected versus actual behavior:
When trying to match indices in kibana, my index is not returned, checking the network logs, it sends a request to: [RootUrl]/elasticsearch/[pattern]/_mapping/field/*?_=[Timestamp]&ignore_unavailable=false&allow_no_indices=false&include_defaults=true. This just returns

{}

On a 404 response. If I manually navigate to the same url but change include_defaults=true to include_defaults=false then the index mappings are returned as expected. Checking the logs (shown below) indicate a NullPointerException being generated in RangeFieldMapper.doXContentBody. I stripped down the mappings to both a nested and non-nested object type in two different indexes, and both have the same behaviour.

Steps to reproduce:
(I can provide the vagrant file + provisioning scripts I'm using if desired)

  1. Create the following separate indices with the mappings:
PUT flat
{
  "mappings": {
    "non-nested-range": {
      "properties": {
        "width": {
          "type": "float_range"
        }
      }
    }
  }
}

PUT nested
{
  "mappings": {
    "nested-range": {
      "properties": {
        "flights": {
          "type": "nested",
          "properties": {
            "months": {
              "type": "integer_range"
            }
          }
        }
      }
    }
  }
}
  1. Navigate to [RootUrl]/elasticsearch/flat/_mapping/field/* and see it returning the expected mapping with a 200 code
  2. Navigate to [RootUrl]/elasticsearch/flat/_mapping/field/*?_=[Timestamp]&ignore_unavailable=false&allow_no_indices=false&include_defaults=true and see it returning just {} under a 404 response code
  3. Navigate to [RootUrl]/elasticsearch/flat/_mapping/field/*?_=[Timestamp]&ignore_unavailable=false&allow_no_indices=false&include_defaults=false and see it returning the expected mapping with a 200 code
  4. Repeat 2-4 but with the pattern of nested instead of flat

Provide logs (if relevant):

[2017-02-02T11:09:28,405][DEBUG][o.e.a.a.i.m.g.TransportGetFieldMappingsIndexAction] [lQNyI3G] null: failed to execute [org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsIndexRequest@29cda818]
org.elasticsearch.transport.RemoteTransportException: [lQNyI3G][127.0.0.1:9300][indices:admin/mappings/fields/get[index][s]]
Caused by: java.lang.NullPointerException
        at org.elasticsearch.index.mapper.RangeFieldMapper.doXContentBody(RangeFieldMapper.java:410) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.index.mapper.FieldMapper.toXContent(FieldMapper.java:382) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction.addFieldMapper(TransportGetFieldMappingsIndexAction.java:215) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction.findFieldMappingsByType(TransportGetFieldMappingsIndexAction.java:174) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction.shardOperation(TransportGetFieldMappingsIndexAction.java:112) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction.shardOperation(TransportGetFieldMappingsIndexAction.java:63) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:294) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$ShardTransportHandler.messageReceived(TransportSingleShardAction.java:287) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) [elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) [elasticsearch-5.2.0.jar:5.2.0]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.2.0.jar:5.2.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

@nknize nknize closed this in 58c34f0 Feb 2, 2017

nknize added a commit that referenced this issue Feb 2, 2017

Fix NPE in RangeFieldMapper.doXContentBody
RangeFieldMapper.doXContentBody should only serialize format and locale when type is set to 'date_range'.

closes #22925

nknize added a commit that referenced this issue Feb 2, 2017

Fix NPE in RangeFieldMapper.doXContentBody
RangeFieldMapper.doXContentBody should only serialize format and locale when type is set to 'date_range'.

closes #22925

nknize added a commit that referenced this issue Feb 2, 2017

Fix NPE in RangeFieldMapper.doXContentBody
RangeFieldMapper.doXContentBody should only serialize format and locale when type is set to 'date_range'.

closes #22925
@Nysosis

This comment has been minimized.

Copy link
Author

commented Feb 3, 2017

Wow, speedy resolution! Nice one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.