Skip to content

Elasticsearch - Unexpected Character Error (Minus Sign) #1066

Open
@marketyler

Description

@marketyler

I am attempting to make a REST call to Elastasearch but am getting the below error message:

{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:3] Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 1, column: 3]"}],"type":"x_content_parse_exception","reason":"[1:3] Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 1, column: 3]","caused_by":{"type":"json_parse_exception","reason":"Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 1, column: 3]"}},"status":400}

Background:
I am trying to pass the json below. But continually get the parsing error that there is a minus sign somewhere. I can take the serialized Json that I am using and put it in Postman and I get results. However, using a RestClient is causing this error. We also use it when running through MuleSoft, also no error. What is different about RestClient? I do not see any minus signs anywhere. You will note in the example below that there are minus signs in the filter and match. however, when I remove them, I still get the parse error. Any help would be appreciated.

{
"size": 10,
"query": {
"bool": {
"must": [
{
"match": {
"host.name.terms.value": "wtclth3002"
}
}
],
"filter": [
{
"range": {
"@timestamp.date_histogram.timestamp": {
"gte": "now-2d/d",
"lte": "now/d"
}
}
}
]
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions