Class Hop

java.lang.Object
org.elasticsearch.client.graph.Hop
All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class Hop
extends java.lang.Object
implements org.elasticsearch.common.xcontent.ToXContentFragment
A Hop represents one of potentially many stages in a graph exploration. Each Hop identifies one or more fields in which it will attempt to find terms that are significantly connected to the previous Hop. Each field is identified using a VertexRequest

An example series of Hops on webserver logs would be:

  1. an initial Hop to find the top ten IPAddresses trying to access urls containing the word "admin"
  2. a secondary Hop to see which other URLs those IPAddresses were trying to access

Optionally, each hop can contain a "guiding query" that further limits the set of documents considered. In our weblog example above we might choose to constrain the second hop to only look at log records that had a reponse code of 404.

If absent, the list of VertexRequests is inherited from the prior Hop's list to avoid repeating the fields that will be examined at each stage.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
  • Field Summary

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor Description
    Hop​(Hop parent)  
  • Method Summary

    Modifier and Type Method Description
    VertexRequest addVertexRequest​(java.lang.String fieldName)
    Add a field in which this Hop will look for terms that are highly linked to previous hops and optionally the guiding query.
    protected java.util.List<VertexRequest> getEffectiveVertexRequests()  
    int getNumberVertexRequests()  
    Hop getParentHop()  
    VertexRequest getVertexRequest​(int requestNumber)  
    org.elasticsearch.index.query.QueryBuilder guidingQuery()  
    void guidingQuery​(org.elasticsearch.index.query.QueryBuilder queryBuilder)
    An optional parameter that focuses the exploration on documents that match the given query.
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    void validate​(ValidationException validationException)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Constructor Details

    • Hop

      public Hop​(Hop parent)
  • Method Details

    • validate

      public void validate​(ValidationException validationException)
    • getParentHop

      public Hop getParentHop()
    • guidingQuery

      public org.elasticsearch.index.query.QueryBuilder guidingQuery()
    • addVertexRequest

      public VertexRequest addVertexRequest​(java.lang.String fieldName)
      Add a field in which this Hop will look for terms that are highly linked to previous hops and optionally the guiding query.
      Parameters:
      fieldName - a field in the chosen index
    • guidingQuery

      public void guidingQuery​(org.elasticsearch.index.query.QueryBuilder queryBuilder)
      An optional parameter that focuses the exploration on documents that match the given query.
      Parameters:
      queryBuilder - any query
    • getEffectiveVertexRequests

      protected java.util.List<VertexRequest> getEffectiveVertexRequests()
    • getNumberVertexRequests

      public int getNumberVertexRequests()
    • getVertexRequest

      public VertexRequest getVertexRequest​(int requestNumber)
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException