When I use the similaritySearch query of ElasticsearchVectorStore, I encounter the following error: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type 'org.springframework.ai.model.Media' from Array value (token 'JsonToken.START_ARRAY') at [Source: REDACTED ('StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION' disabled); line: 1, column: 23047] (through reference chain: org.springframework.ai.document.Document["media"])

main code:

@Bean
public ElasticsearchVectorStore vectorStore(RestClient restClient, OllamaEmbeddingModel embeddingModel) {
    ElasticsearchVectorStoreOptions options = new ElasticsearchVectorStoreOptions();
    options.setIndexName("ai-knowledge");    // Optional: defaults to "spring-ai-document-index"
    options.setDimensions(768);             // Optional: defaults to model dimensions or 1536

    return ElasticsearchVectorStore.builder()
            .restClient(restClient)
            .embeddingModel(embeddingModel)
            .options(options)
            .initializeSchema(true)
            .build();
}

Code Triggering the Error:

List<Document> documents = vectorStore.similaritySearch(searchRequest);

What is causing this issue, and how can it be resolved?

This issue did not occur in previous versions. It only appeared when I started using the version spring-ai-elasticsearch-store-1.0.0-20241218.231705-882.jar.

Comment From: pipijoe

I created a new index, and the issue disappeared.