У меня возникла очень странная проблема, я в основном пытаюсь сохранить объект в упругом поиске с помощью пружинных ботинков и репозиториев, и по каким-то причинам мои объекты никогда не сохраняются.Весенний эластичный поисковый репозиторий не хранит данные
Это делается, с помощью Scala
случай класс:
@Document(collection = "SPECTRUM")
@org.springframework.data.elasticsearch.annotations.Document(indexName = "spectrum", `type` = "spectrum", shards = 1, replicas = 0, refreshInterval = "-1")
case class Spectrum(
@([email protected])(`type` = FieldType.Nested)
biologicalCompound: Compound,
@([email protected])(`type` = FieldType.Nested)
chemicalCompound: Compound,
@([email protected])(`type` = FieldType.Nested)
predictedCompound: Compound,
@(Indexe[email protected])
deleted: Boolean,
@([email protected])
id: String,
lastUpdated: String,
@([email protected])(`type` = FieldType.Nested)
metaData: Array[MetaData],
score: Score,
spectrum: String,
splash: Splash,
submitter: Submitter,
@([email protected])(`type` = FieldType.Nested)
tags: Array[Tags],
@([email protected])(`type` = FieldType.Nested)
authors: Array[Author]
)
}
хранилище
@Repository("spectrumElasticRepository")
trait ISpectrumElasticRepositoryCustom extends ElasticsearchRepository[Spectrum, String] with SpectrumElasticRepositoryCustom{
def findByBiologicalCompoundInchiKey(inchiKey: String) : java.util.List[Spectrum]
}
тестовый код
getRepository.deleteAll()
assert(getRepository.count() == 0)
s"we should be able to store our data" in {
for (spectrum <- exampleRecords) {
val result = getRepository.save(spectrum)
assert(result.isInstanceOf[Spectrum])
}
assert(getRepository.count() == 58)
val data:Iterable[Spectrum] = getRepository.findAll()
}
раз тестовый код попадет эту строку
val data:Iterable[Spectrum] = getRepository.findAll()
это вызывает следующее исключение
failed to map source [ {}] to class Spectrum
org.springframework.data.elasticsearch.ElasticsearchException: failed to map source [ {}] to class Spectrum
и глядя на упругий поисковом сервере непосредственно
localhost:9200/spectrum/_search
это выглядит как нет данные фактически привязаны к любому из сообщенных хитов
{
"_index": "spectrum",
"_type": "spectrum",
"_id": "AVNhcpHjnm4IHnHomcXj",
"_score": 1,
"_source": {}
},
поскольку источник пуст.
любые идеи, что вызывает это?