Class MoreLikeThisQueryBuilder

All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, QueryBuilder, Rewriteable<QueryBuilder>

public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQueryBuilder>
A more like this query that finds documents that are "like" the provided set of document(s). The documents are provided as a set of strings and/or a list of MoreLikeThisQueryBuilder.Item.
  • Field Details

  • Constructor Details

    • MoreLikeThisQueryBuilder

      public MoreLikeThisQueryBuilder(String[] likeTexts, MoreLikeThisQueryBuilder.Item[] likeItems)
      Constructs a new more like this query which uses the default search field.
      Parameters:
      likeTexts - the text to use when generating the 'More Like This' query.
      likeItems - the documents to use when generating the 'More Like This' query.
    • MoreLikeThisQueryBuilder

      public MoreLikeThisQueryBuilder(@Nullable String[] fields, @Nullable String[] likeTexts, @Nullable MoreLikeThisQueryBuilder.Item[] likeItems)
      Sets the field names that will be used when generating the 'More Like This' query.
      Parameters:
      fields - the field names that will be used when generating the 'More Like This' query.
      likeTexts - the text to use when generating the 'More Like This' query.
      likeItems - the documents to use when generating the 'More Like This' query.
    • MoreLikeThisQueryBuilder

      public MoreLikeThisQueryBuilder(StreamInput in) throws IOException
      Read from a stream.
      Throws:
      IOException
  • Method Details