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

_field_stats returns server error when index contains an IP field #20516

Closed
Bargs opened this issue Sep 15, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@Bargs
Copy link

commented Sep 15, 2016

Elasticsearch version: 5.0-beta1, master

Plugins installed: none

JVM version: java version "1.8.0_60"

OS version: OSX El Capitan

Description of the problem including expected versus actual behavior:

_field_stats returns an INTERNAL_SERVER_ERROR when the request includes an IP field.

Steps to reproduce:
1 Create an index with an IP field mapping:

PUT /ip
{
    "mappings": {
        "ip": {
            "properties": {
                "ip": {
                    "type": "ip"
                }
            }
        }
    }
}

2 Add a simple source document

POST /ip/ip

{
    "ip": "192.168.1.1"
}

3 Issue a _field_stats request for that field and see the error

GET /ip/_field_stats?fields=ip

Response:
{
  "_shards": {
    "total": 5,
    "successful": 4,
    "failed": 1,
    "failures": [
      {
        "shard": 1,
        "index": "ip",
        "status": "INTERNAL_SERVER_ERROR",
        "reason": {
          "type": "exception",
          "reason": "java.lang.IllegalArgumentException: encoded bytes are of incorrect length",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "encoded bytes are of incorrect length",
            "caused_by": {
              "type": "unknown_host_exception",
              "reason": "addr is of illegal length"
            }
          }
        }
      }
    ]
  },
  "indices": {
    "_all": {
      "fields": {}
    }
  }
}

Provide logs (if relevant):

DEBUG - ip - action_fieldstats - [1], node[SrkoA9nWQzeJaFbEamzoqQ], [P], s[STARTED], a[id=Vn9wP1hhSx2M1NUmAombsg]: failed to execute [org.elasticsearch.action.fieldstats.FieldStatsRequest@7d8ef303]
INFO - ? - ? - org.elasticsearch.transport.RemoteTransportException: [SrkoA9n][127.0.0.1:9300][indices:data/read/field_stats[s]]
INFO - ? - ? - Caused by: org.elasticsearch.ElasticsearchException: java.lang.IllegalArgumentException: encoded bytes are of incorrect length
INFO - ? - ? - at org.elasticsearch.ExceptionsHelper.convertToElastic(ExceptionsHelper.java:55) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:204) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:57) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:300) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:296) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.TransportService$5.doRun(TransportService.java:534) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
INFO - ? - ? - at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
INFO - ? - ? - Caused by: java.lang.IllegalArgumentException: encoded bytes are of incorrect length
INFO - ? - ? - at org.apache.lucene.document.InetAddressPoint.decode(InetAddressPoint.java:187) ~[lucene-sandbox-6.2.0.jar:6.2.0 764d0f19151dbff6f5fcd9fc4b2682cf934590c5 - mike - 2016-08-20 05:39:36]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.FieldStats.readFrom(FieldStats.java:609) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.io.stream.StreamInput.readOptionalWriteable(StreamInput.java:682) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.indices.IndicesService.getFieldStats(IndicesService.java:1143) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:198) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:57) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:300) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:296) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.TransportService$5.doRun(TransportService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_60]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_60]
INFO - ? - ? - at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_60]
INFO - ? - ? - Caused by: java.net.UnknownHostException: addr is of illegal length
INFO - ? - ? - at java.net.InetAddress.getByAddress(InetAddress.java:1042) ~[?:1.8.0_60]
INFO - ? - ? - at java.net.InetAddress.getByAddress(InetAddress.java:1439) ~[?:1.8.0_60]
INFO - ? - ? - at org.apache.lucene.document.InetAddressPoint.decode(InetAddressPoint.java:184) ~[lucene-sandbox-6.2.0.jar:6.2.0 764d0f19151dbff6f5fcd9fc4b2682cf934590c5 - mike - 2016-08-20 05:39:36]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.FieldStats.readFrom(FieldStats.java:609) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.io.stream.StreamInput.readOptionalWriteable(StreamInput.java:682) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.indices.IndicesService.getFieldStats(IndicesService.java:1143) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:198) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.fieldstats.TransportFieldStatsAction.shardOperation(TransportFieldStatsAction.java:57) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:300) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:296) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.transport.TransportService$5.doRun(TransportService.java:534) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_60]
INFO - ? - ? - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_60]
INFO - ? - ? - at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_60]

@jimczi jimczi self-assigned this Sep 16, 2016

jimczi added a commit that referenced this issue Sep 16, 2016

Fix FieldStats deserialization of `ip` field (#20522)
* Fix FieldStats deserialization of `ip` field

Add missing readBytes in `ip` field deserialization
Add (de)serialization tests for all types
This change also removes the ability to set FieldStats.minValue or FieldStats.maxValue to null.
This is not required anymore since the stats are built on fields with values only.

Fixes #20516

jimczi added a commit that referenced this issue Sep 16, 2016

Fix FieldStats deserialization of `ip` field (#20522)
* Fix FieldStats deserialization of `ip` field

Add missing readBytes in `ip` field deserialization
Add (de)serialization tests for all types
This change also removes the ability to set FieldStats.minValue or FieldStats.maxValue to null.
This is not required anymore since the stats are built on fields with values only.

Fixes #20516

jimczi added a commit that referenced this issue Sep 16, 2016

Fix FieldStats deserialization of `ip` field (#20522)
* Fix FieldStats deserialization of `ip` field

Add missing readBytes in `ip` field deserialization
Add (de)serialization tests for all types
This change also removes the ability to set FieldStats.minValue or FieldStats.maxValue to null.
This is not required anymore since the stats are built on fields with values only.

Fixes #20516
@Bargs

This comment has been minimized.

Copy link
Author

commented Sep 16, 2016

Thanks for the quick fix @jimferenczi !

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.