@Document(indexName="china",type="province")
public class China implements Serializable{
private static final long serialVersionUID = 1L;
@Id
private String id;
@Field(type=FieldType.text)
private String provinceNmae;
@Field(type=FieldType.Nested)
private List<City> listCity;//市
get;set;
}
@Component
public interface IChinaRepository extends ElasticsearchRepository<China, String> {}
@RestController
public class ChinaController {
@Autowired
private IChinaRepository repository;
@GetMapping("cgetf")
public Iterable<China> getChina(){
List<String> ids=new ArrayList<>();
ids.add("p1");
ids.add("p2");
ids.add("p3");
Iterable<China> list = this.repository.findAllById(ids);
return list;
}
}
启动springboot 报如下错误:
Caused by: java.lang.IllegalArgumentException: object mapping [listCity] can't be changed from non-nested to nested
1 个回复
wy993322 - 90
赞同来自: