Wednesday 2 December 2015

Elasticsearch: Java: ids query

Return documents that have provided ids.

QueryBuilder builder = QueryBuilders.idsQuery(new String[] { "titles", "philosophy" }).ids(new String[] { "1", "4" });


Above query generates following json document.

{
  "ids" : {
    "types" : [ "titles", "philosophy" ],
    "values" : [ "1", "4" ]
  }
}


The type is optional and can be omitted, and can also accept an array of values.



Previous                                                 Next                                                 Home

No comments:

Post a Comment