de.otto.flummi.query.HasChildQueryBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flummi Show documentation
Show all versions of flummi Show documentation
Helper library for elasticsearch
The newest version!
package de.otto.flummi.query;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import static de.otto.flummi.request.GsonHelper.object;
public class HasChildQueryBuilder implements QueryBuilder {
private final String type;
private final QueryBuilder query;
public HasChildQueryBuilder(String type, QueryBuilder query) {
this.type = type;
this.query = query;
}
@Override
public JsonObject build() {
JsonObject hasChild = new JsonObject();
hasChild.add("type", new JsonPrimitive(type));
hasChild.add("query", query.build());
return object(
"has_child",
hasChild);
}
}