NullPointerException in Elasticsearch when adding Index Pattern in kibana

Hey,
I noticed the following exception in the Elasticsearch logs

[2019-06-27T13:05:54,761][DEBUG][o.e.a.f.TransportFieldCapabilitiesIndexAction] [mpps-st-elastic-1] null: failed to execute [org.elasticsearch.action.fieldcaps.FieldCapabilitiesIndexRequest@37bdc2bd]
org.elasticsearch.transport.RemoteTransportException: [mpps-st-elastic-1][10.99.99.34:9300][indices:data/read/field_caps[index][s]]
Caused by: java.lang.NullPointerException
	at org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction.shardOperation(TransportFieldCapabilitiesIndexAction.java:105) ~[elasticsearch-6.7.2.jar:6.7.2]
	at org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction.shardOperation(TransportFieldCapabilitiesIndexAction.java:46) ~[elasticsearch-6.7.2.jar:6.7.2]
	at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$1.doRun(TransportSingleShardAction.java:115) [elasticsearch-6.7.2.jar:6.7.2]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:751) [elasticsearch-6.7.2.jar:6.7.2]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.7.2.jar:6.7.2]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

This exception appears in the Elasticsearch logs when trying to add in a kibana index pattern.

And i can see only meta fields

Definition of the index:

DELETE /test02

PUT test02
{
  "mappings": {
    "properties": {
      "app_name": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          },
          "prefix_app_name": {
            "type": "text",
            "index_prefixes": {
              "min_chars": 1,
              "max_chars": 19
            }
          }
        }
      }
    }
  }
}
POST /test02/_doc
{
  "app_name":"my super app1"
}

I suspect that the reason for the problems is using index_prefixes.

When I create an index patter for an analogical index (test01), but without index_prefixes, the problem does not appear.

DELETE /test01

PUT test01
{
  "mappings": {
      "properties": {
        "app_name": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        }
      }
    }
}
POST /test01/_doc
{
  "app_name":"my super app1"
}

And I can see all fields

I tested this on Elasticsearch 6.7.2, Kibana 6.7.2 and on Elasticsearch 6.8.0, Kibana 6.8.0.

I noticed same issue in latest Elasticsearch 7.2.0 and Kibana 7.2.0

[2019-06-28T09:30:23,773][DEBUG][o.e.a.f.TransportFieldCapabilitiesIndexAction] [marekm] null: failed to execute [org.elasticsearch.action.fieldcaps.FieldCapabilitiesIndexRequest@39f72cd4]
org.elasticsearch.transport.RemoteTransportException: [marekm][127.0.0.1:9300][indices:data/read/field_caps[index][s]]
Caused by: java.lang.NullPointerException
	at org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction.shardOperation(TransportFieldCapabilitiesIndexAction.java:106) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction.shardOperation(TransportFieldCapabilitiesIndexAction.java:46) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.action.support.single.shard.TransportSingleShardAction$1.doRun(TransportSingleShardAction.java:113) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:758) [elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-7.2.0.jar:7.2.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_171]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_171]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]

Please help.
Am I doing something incorrectly ? This is a bug in Elasticsearch / Kibana ?

Not sure but it's marked as a DEBUG log.

Thank you for your response.

Yes, it is marked as DEBUG, but.. for me NullPointerException means that something goes really wrong in unexpected way (I'm Java dev).

The NPE is thrown by

org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction.shardOperation(TransportFieldCapabilitiesIndexAction.java:106)

line 106:
String type = mapper.nested().isNested() ? "nested" : "object";

For me it's means that mapper or mapper.nested is null.. and I dont known why.

In addition, Kibana still does not see the index fields and I can not implement the planned functionalities.

Please let me know if I am using index_prefixes in the wrong way, or is it a Elasticsearch bug.
Meantime I will try to make some debug Elasticsearch source code. This can be interesting adventure :smile:

Regards

1 Like

Absolutely. Could you open an issue in elasticsearch repo? I "think" the issue is coming from Kibana though which is may be misreading the mapping but at least we should not keep an NPE in the code.

According to your advice, I opened a issue:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.