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

Elasticsearch - Unexpected Character Error (Minus Sign) #1066

Open
marketyler opened this issue Dec 12, 2023 · 1 comment
Open

Elasticsearch - Unexpected Character Error (Minus Sign) #1066

marketyler opened this issue Dec 12, 2023 · 1 comment

Comments

@marketyler
Copy link

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"
}
}
}
]
}
}
}

@picandocodigo
Copy link
Member

Hi @marketyler,
Which version of the client are you using? And which client? RestClient suggests maybe the Java Elasticsearch client?

It would help if you could share the code where you're defining the JSON and passing it to the client. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants