Stack Exchange
Slow save in elasticsearch repository
I'm using spring-data-elasticsearch (https://github.com/spring-projects/spring-data-elasticsearch) and I have two entity classes:
@Document(indexName = "aa", type = "aa", shards = 5, replicas = 1, refreshInterval = "-1", indexStoreType = "memory")
class AA {

     @Id
     private Long Id;

     private BB bb;
     private String field1;

     // ... Many more Fields.

     // ... getters and setters
}

@Document(indexName = "bb", type = "bb", shards = 5, replicas = 1, refreshInterval = "-1", indexStoreType = "memory")
class BB {

     @Id
     private Long Id;

     private BB bbParent;

     // ... Many more Fields.

     // ... getters and setters
}

When I'm saving  to AA repository
aaRepository.save(aa);

I have strange behavior: when bbParent is null, everything is fine, but when bbParent is set, saving takes much (>100 times) longer.
Do you have any hints?

it looks like recursive BB class creating problem, but it can be something else as well. can you share some more code please ? or probable entire project on github ?

sorry, but I'm not able to make github project now. problem was that saving to ES repository take a while when my aa objects is very big. do you know is there a annotation so I can exclude some fields when saving to ES repository?
