0

System Specs

Elasticsearch version 6.7.0 running in application
Elasticsearch version 6.3.2 running on docker container

POM looks like this below

        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>6.7.0</version>
        </dependency>

        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>6.70</version>
        </dependency>

Issue

I have a date field which uses the mapping below

 "thisIsDate": {
      "type": "date",
      "format": "strict_date_time"
    }

The field is set up like in my application

 @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX", shape = JsonFormat.Shape.STRING, timezone = "UTC")
    public Instant thisIsDate;

And the data I am inserting into that field looks like this.

1900-10-22T12:34:56.78Z

But I keep getting back

"reason":"failed to parse date field with format [basic_date_time]"

I have used the following formats in the mapping but none of them fix my problem

1. date_time 
2. basic_date_time 
3. strict_date_time
4. "yyyy-MM-dd'T'HH:mm:ss.SSSX"

Could someone point me in the right direction?

5
  • in your first statement, you mentioned two versions to elasticsearch, what does it mean and hope you are using the same version of ES client as of ES server. Commented Jun 4, 2020 at 16:22
  • No, I am using a docker container that has a different version than the es being used on the spring-boot app. @OpsterElasticsearchNinja Commented Jun 4, 2020 at 17:02
  • you should use the same version of ES client and server, can you do that and tell me If issue is still there? Commented Jun 4, 2020 at 17:48
  • You are correct. If I use the same versions it works. But my requirements need me to use 6.3.2. Any workarounds or solutions you can think of to get them to work with each other? Commented Jun 4, 2020 at 17:57
  • No, you need to use the same version of ES server and client as there are compatibility issues if you use different versions and that's the reason elasticsearch releases even client with every minor release like 7.4,7.5,7.6,7.7 if these could work without any issues then there was no need to do that Commented Jun 4, 2020 at 18:07

1 Answer 1

1

The issue is happening due to incompatible version of Elasticsearch server and Elasticsearch client.

As mentioned in every release there are some changed being introduced in the server which won't work if you don't upgrade your client version and that's the reason elasticsearch releases even client with every minor release like 7.4,7.5,7.6,7.7 if these could work without any issues then there was no need to do that.

This is a known issue and there are several StackOverflow posts related to various weird issues when Elasticsearch client doesn't match the server version.

Best and neat solution is to make sure you use the same version of both server and client and update both of them simultaneously to avoid these weird issues.

Sign up to request clarification or add additional context in comments.

1 Comment

Anytime and glad we catched it early and saved a lot of time as I hv mentioned hv seen various weird issues related to this on SO .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.