Problem with ElasticsearchRepository

Hi All I am not sure if this is the right place to ask this question.
I am using Elasticsearch 7.11 and Spring-Boot 2.4.4

import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;
import uk.co.wowcher.ingest.repository.elasticsearch.model.LocationDocument;

@Repository
public interface rep extends ElasticsearchRepository<LocationDocument, Long> {
}

here is the document mapping

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "location", createIndex = false)
@JsonIgnoreProperties(ignoreUnknown = true)
public class LocationDocument {
@Id
public Long id;
public LatLon latLon;
}

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class LatLon {

private Float lat;
private Float lon;

}

If I save the content in elasticsearch as rep.save( single object) no issue
But if I try to save as rep.saveAll(List) then it keep throwning the following error

org.springframework.data.elasticsearch.BulkFailureException: Bulk operation has failures. Use ElasticsearchException.getFailedDocuments() for detailed messages [{276158=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 277009=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 276669=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 276582=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 277011=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 277010=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];, 275849=ElasticsearchException[Elasticsearch exception [type=mapper_parsing_exception, reason=failed to parse field [latLon] of type [geo_point]]]; nested: ElasticsearchException[Elasticsearch exception [type=parse_exception, reason=field [lat] missing]];}]
at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.checkForBulkOperationFailure(AbstractElasticsearchTemplate.java:529)
at org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate.doBulkOperation(ElasticsearchRestTemplate.java:228)
at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.bulkOperation(AbstractElasticsearchTemplate.java:302)
at org.springframework.data.elasticsearch.core.AbstractElasticsearchTemplate.bulkIndex(AbstractElasticsearchTemplate.java:286)

Welcome!

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Here is what I've been doing:

And

Any chance you can debug this and see what is actually sent as a json document to elasticsearch?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.