org.elasticsearch.index.query
Class WrapperQueryBuilder

java.lang.Object
  extended by org.elasticsearch.index.query.BaseQueryBuilder
      extended by org.elasticsearch.index.query.WrapperQueryBuilder
All Implemented Interfaces:
ToXContent, QueryBuilder

public class WrapperQueryBuilder
extends BaseQueryBuilder

A Query builder which allows building a query thanks to a JSON string or binary data. This is useful when you want to use the Java Builder API but still have JSON query strings at hand that you want to combine with other query builders.

Example usage in a boolean query :

 BoolQueryBuilder bool = new BoolQueryBuilder();
      bool.must(new WrapperQueryBuilder("{\"term\": {\"field\":\"value\"}}");
      bool.must(new TermQueryBuilder("field2","value2");
 
 


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Constructor Summary
WrapperQueryBuilder(byte[] source, int offset, int length)
           
WrapperQueryBuilder(String source)
          Builds a JSONQueryBuilder using the provided JSON query string.
 
Method Summary
protected  void doXContent(XContentBuilder builder, ToXContent.Params params)
           
 
Methods inherited from class org.elasticsearch.index.query.BaseQueryBuilder
buildAsBytes, buildAsBytes, toString, toXContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrapperQueryBuilder

public WrapperQueryBuilder(String source)
Builds a JSONQueryBuilder using the provided JSON query string.


WrapperQueryBuilder

public WrapperQueryBuilder(byte[] source,
                           int offset,
                           int length)
Method Detail

doXContent

protected void doXContent(XContentBuilder builder,
                          ToXContent.Params params)
                   throws IOException
Specified by:
doXContent in class BaseQueryBuilder
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.