Skip to content

Exception when using source filtering on a large integer field #32395

@ohadravid

Description

@ohadravid

Elasticsearch version (bin/elasticsearch --version): 6.3.1 using the official docker image

Plugins installed: []

Description of the problem including expected versus actual behavior:

When indexing a document with a large integer field as (with keyword mappings`, querying fails with an error when using source filtering.
This seems a bit similar to #31853, but different enough that I thought I should open an issue.

Steps to reproduce:

  1. Using the official Elasticsearch package in python:
es.indices.create('test-index')
es.indices.put_mapping(doc_type='doc', index='test-index', body={
    'properties': {
        'offset': {
            'type': 'keyword'
        }
    }
})
es.index('test-index', 'doc', {'offset': 2 ** 2500})
  1. While a regular query works as expected:
>>> es.search(index='test-index', body={
    'query': {'match_all': {}}, 
    'size': 10
})

{ 'hits': { 'hits': [ '_source': {'offset': 37....} ...}

Using source-filtering will result in an exception:

>>> es.search(index='test-index', body={
    '_source': ['offset'], 
    'query': {'match_all': {}}, 
    'size': 10
})

{'_shards': {'failed': 1,
  'failures': [{'index': 'test-index',
    'node': 'G2YpLXsGTNGrEphsO5SASQ',
    'reason': {'reason': 'cannot write xcontent for unknown value of type class java.math.BigInteger',
     'type': 'illegal_argument_exception'},
    'shard': 1}],
  'skipped': 0,
  'successful': 4,
  'total': 5},
 'hits': {'hits': [], 'max_score': 1.0, 'total': 1},
 'timed_out': False,
 'took': 8}

(Using '_source': ['*'] will result in the same error)

Provide logs (if relevant):
When using a scroll query, the server log shows the following error:

[2018-07-26T07:05:35,682][DEBUG][o.e.a.s.TransportSearchScrollAction] [server-name] [157387] Failed to execute fetch phase
org.elasticsearch.transport.RemoteTransportException: [server-name][10.0.0.7:9300][indices:data/read/search[phase/fetch/id/scroll]]
Caused by: java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class java.math.BigInteger
       at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:755) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.map(XContentBuilder.java:810) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:744) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:837) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:746) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.map(XContentBuilder.java:810) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:744) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.xcontent.XContentBuilder.value(XContentBuilder.java:726) ~[elasticsearch-x-content-6.3.1.jar:6.3.1]
       at org.elasticsearch.search.fetch.subphase.FetchSourceSubPhase.hitExecute(FetchSourceSubPhase.java:65) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:162) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:516) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.action.search.SearchTransportService$10.messageReceived(SearchTransportService.java:430) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.action.search.SearchTransportService$10.messageReceived(SearchTransportService.java:427) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:66) ~[elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:664) [elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:725) [elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) [elasticsearch-6.3.1.jar:6.3.1]
       at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.3.1.jar:6.3.1]
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135) [?:?]
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
       at java.lang.Thread.run(Thread.java:844) [?:?]

Metadata

Metadata

Labels

:Search/SearchSearch-related issues that do not fall into other categories>bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions