I'm just getting started with elasticsearch with spring which is both technologies wich are completly new to me. I have uploaded data to an elasticseach index with logstash and I can search it successfully using kebana. However when i try to return from an index to a webpage using spring it only returns empty json-objects, but the right amount of empty objects. Did I upload the data incorrectly or is something wrong with my code? I don't understand why this is happening and would appriciate any help I can get. You can find some code bellow.
Code for type:
@Document(indexName="usmgbg_index", type="usmgbg_type")
public class Usmgbg {
@Id
private String ID;
private String Source, Name, Profession, Country, FileName, LastModified, OwnerID;
}
Repository:
@Repository
public interface UsmgbgRepository extends ElasticsearchRepository<Usmgbg, String>{}
Controller:
@RestController
public class UsmgbgController {
@Autowired
private UsmgbgRepository repository;
@GetMapping("usmgbg/findall")
public List<Usmgbg> findAllCustomers() {
List<Usmgbg> items = new ArrayList<>();
repository.findAll().forEach(items::add);
return items;
}
}
The output I'm getting from findAllCustomers looks like: [{},{},{},{},....]