I am writing a query; in Kibana it's easy
GET populationstreamassignment/_search
{
"query": {
"match": {
"healthyChildrenIndicator": true
}
},
"_source": "memberId"
}
What I want to do is get a list of all the memberId's for 'healthy children'. But I want to translate this to java syntax.
import java.util.List;
import java.util.UUID;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
Spring Data Elasticsearch repository for the {@link PopulationStreamAssignment} entity.
*/
public interface PopulationStreamAssignmentSearchRepository extends ElasticsearchRepository<PopulationStreamAssignment, Long> {
@Query("{\"match\": {\"?0\": \"?1\"}}")
List<UUID> getMemberIdsByPopulationStream(String popStream, Boolean criteria);
}
This query has a few problems. Here is where I have questions..
- How can I specify "_source" so that I only return the memberId field?
- memberId is a UUID, can I have it directly return memberId's as a List of Values?