# Elasticsearch returns empty json-objects

**URL:** <https://discuss.elastic.co/t/elasticsearch-returns-empty-json-objects/208362>\
**Category:** Elasticsearch\
**Created:** [November 18, 2019, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-returns-empty-json-objects/208362 "2019-11-18T17:33:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![william\_ganrot](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/william_ganrot/32/57878_2.png) [@william\_ganrot](https://discuss.elastic.co/u/william_ganrot)\
**Post date:** [November 18, 2019, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-returns-empty-json-objects/208362/1 "2019-11-18T17:33:25Z")

</div>

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: [{},{},{},{},....]

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 16, 2019, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-returns-empty-json-objects/208362/2 "2019-12-16T17:33:30Z")

</div>

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