cbelasticsearch

Class Document

lucee.Component
    extended by cbelasticsearch.Document

Elasticsearch Document Object

Class Attributes:
  • license : Apache v2.0
  •  
  • package : cbElasticsearch.models
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Jon Clausen
  •  
    Property Summary
    type property default serializable required
    any config


    • access = public
    • returntype = any
    • inject = Config@cbElasticsearch
    true false
    any highlights
          Highlights for the document in search results.

    • access = public
    • returntype = any
    true false
    any id
          The `_id` value of the document.

    • access = public
    • returntype = any
    true false
    any index
          The index which contains or will contain this document.

    • access = public
    • returntype = any
    true false
    any memento
          The structural representation of the document object.

    • access = public
    • returntype = any
    true false
    any score
          A hit score for documents in search results.

    • access = public
    • returntype = any
    true false
    any type
          The type within the index where this document will be categorized.

    • access = public
    • returntype = any
    true false
    Method Summary
    boolean delete()
         Deletes the currently active document.
    any get([string id], [string index], [string type])
         Loads a document.
    Client getClient()
         Client provider.
    string getConfig()
    struct getDocument([boolean includeKey='false'])
         Convenience method for a flattened struct of the memento.
    string getHighlights()
    string getId()
    string getIndex()
    string getMemento()
    string getScore()
    string getType()
    any getValue(string key, [any default])
         Gets a key value within the current document.
    Document new([string index], [string type], [struct properties='[runtime expression]'])
         Returns a new Document instance.
    any onDIComplete()
    Document populate(struct properties)
         Populates an existing document object.
    any reset()
    any save()
         Persists the document to Elasticsearch.
    any setConfig(any config)
    any setHighlights(any highlights)
    any setId(any id)
    any setIndex(any index)
    any setMemento(any memento)
    any setScore(any score)
    any setType(any type)
    any setValue(string name, any value)
         Sets a key value within the current document.
    string toString([boolean includeKey='false'])
         Returns the JSON string of the document object.
     
    Methods inherited from class lucee.Component
    None

    Property Detail

    config

    property any config

    Attributes:
    access - public
    required - false
    returntype - any
    inject - Config@cbElasticsearch
    serializable - true

    highlights

    property any highlights

    Highlights for the document in search results

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    id

    property any id

    The `_id` value of the document

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    index

    property any index

    The index which contains or will contain this document

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    memento

    property any memento

    The structural representation of the document object

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    score

    property any score

    A hit score for documents in search results

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    type

    property any type

    The type within the index where this document will be categorized

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    delete

    public boolean delete()

    Deletes the currently active document

    Returns:
    a boolean denoting whether the document was deleted

    get

    public any get([string id], [string index], [string type])

    Loads a document

    Parameters:
    id - string The `_id` of the document to retrieve
    index - string The index of the document
    type - string The type of the document

    getClient

    public Client getClient()

    Client provider


    getConfig

    public string getConfig()


    getDocument

    public struct getDocument([boolean includeKey='false'])

    Convenience method for a flattened struct of the memento

    Parameters:
    includeKey - boolean Whether to include the document key in the returned packet

    getHighlights

    public string getHighlights()


    getId

    public string getId()


    getIndex

    public string getIndex()


    getMemento

    public string getMemento()


    getScore

    public string getScore()


    getType

    public string getType()


    getValue

    public any getValue(string key, [any default])

    Gets a key value within the current document

    Parameters:
    key - string the key to search
    default
    Returns:
    any|null returns null if the key does not exist in the current document

    new

    public Document new([string index], [string type], [struct properties='[runtime expression]'])

    Returns a new Document instance

    Parameters:
    index - string the index name
    type - string the index type
    properties - struct the structural representation of the document

    onDIComplete

    public any onDIComplete()


    populate

    public Document populate(struct properties)

    Populates an existing document object

    Parameters:
    properties - struct the structural representation of the document

    reset

    public any reset()


    save

    public any save()

    Persists the document to Elasticsearch


    setConfig

    public any setConfig(any config)

    Parameters:
    config

    setHighlights

    public any setHighlights(any highlights)

    Parameters:
    highlights

    setId

    public any setId(any id)

    Parameters:
    id

    setIndex

    public any setIndex(any index)

    Parameters:
    index

    setMemento

    public any setMemento(any memento)

    Parameters:
    memento

    setScore

    public any setScore(any score)

    Parameters:
    score

    setType

    public any setType(any type)

    Parameters:
    type

    setValue

    public any setValue(string name, any value)

    Sets a key value within the current document

    Parameters:
    name - string the key name
    value - string the key value

    toString

    public string toString([boolean includeKey='false'])

    Returns the JSON string of the document object

    Parameters:
    includeKey - boolean Whether to include the document key in the returned packet