elasticsearch

command module
v0.0.0-...-8835833 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README


{ "image": "direktiv/elasticsearch", "desc": "Writes a new JSON document to an index or queries an index in its entirety." }

Elasticsearch

Writes a new document to an index or queries an index in its entirety.

Direktiv

An example workflow of using the Elasticsearch container for either options

id: test2
description: "" 
functions:
- id: es
  image: direktiv/elasticsearch:v1
states:
- id: hello
  type: action
  action:
    function: es
    input: jq(.)

Input

Query

Searches the index and returns all the results.

input:
  method: "query"
  index: "direktiv"
  addresses: ["http://192.168.1.30:9200"]

Store

Stores the record under the index provided.

input:
  method: "store"
  index: "direktiv"
  addresses: ["http://192.168.1.30:9200"]
  record:
    test: "test2"
    thisiscool: "yeahcool"

Output

The output of both these operations returns what elasticsearch sends back.

Query

{
  "return": {
    "_shards": {
      "failed": 0,
      "skipped": 0,
      "successful": 1,
      "total": 1
    },
    "hits": {
      "hits": [
        {
          "_id": "Ya0eqngBJ4CrZdCbJqyO",
          "_index": "direktiv",
          "_score": 1,
          "_source": {
            "test": "test2"
          },
          "_type": "_doc"
        },
        {
          "_id": "Yq0fqngBJ4CrZdCbZ6xR",
          "_index": "direktiv",
          "_score": 1,
          "_source": {
            "test": "test2",
            "thisiscool": "yeahcool"
          },
          "_type": "_doc"
        }
      ],
      "max_score": 1,
      "total": {
        "relation": "eq",
        "value": 2
      }
    },
    "timed_out": false,
    "took": 1
  }
}{
  "return": {
    "_shards": {
      "failed": 0,
      "skipped": 0,
      "successful": 1,
      "total": 1
    },
    "hits": {
      "hits": [
        {
          "_id": "Ya0eqngBJ4CrZdCbJqyO",
          "_index": "direktiv",
          "_score": 1,
          "_source": {
            "test": "test2"
          },
          "_type": "_doc"
        },
        {
          "_id": "Yq0fqngBJ4CrZdCbZ6xR",
          "_index": "direktiv",
          "_score": 1,
          "_source": {
            "test": "test2",
            "thisiscool": "yeahcool"
          },
          "_type": "_doc"
        }
      ],
      "max_score": 1,
      "total": {
        "relation": "eq",
        "value": 2
      }
    },
    "timed_out": false,
    "took": 1
  }
}

Store

{
  "return": {
    "_id": "Yq0fqngBJ4CrZdCbZ6xR",
    "_index": "direktiv",
    "_primary_term": 1,
    "_seq_no": 1,
    "_shards": {
      "failed": 0,
      "successful": 1,
      "total": 2
    },
    "_type": "_doc",
    "_version": 1,
    "result": "created"
  }
}

Error

In the case that an error is encountered, it will present in the following format:

{
    "errorCode": "com.elasticsearch.error",
    "errorMsg": "Something went wrong"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL