You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ashika Umanga Umagiliya <um...@gmail.com> on 2018/12/03 07:12:58 UTC
Solr nested documents : Query for child documents filtered by a
parent field
I have following parent-child models
parent:
--------
public class DataSet {
@Field
private String id;
@Field
private String type="type_dataset";
@Field
private String name;
@Field
private String dataSourceId;
@Field
private String serviceId;
@Field(child=true)
private List<DataSetColumn> columns;
}
child:
--------
public class DataSetColumn {
@Field
private String id;
@Field
private String name;
@Field
private String type="type_column";
}
I can query for parent documents filtered by fields belongs to the parent
as :
>
http://solrserver:8886/solr/BeanTest10/select?q=*:*&fq=(type:type_dataset)&fl=*,[child
> parentFilter=type:type_dataset]&wt=json&indent=true
Now I want to :
1) Query for "DataSetColumns"(child documents) filtered by serviceId
(parent field)
2) also return "dataSourceId" which is a field in parent in the response
(DataSet)
How can I achieve this ?