elasticsearch-interchange-0.2.0.0: Serialization of Elasticsearch requests and responses
Safe HaskellSafe-Inferred
LanguageHaskell2010

Elasticsearch.Bulk.Response

Description

Response to /_bulk request.

Synopsis

Types

data Response Source #

Constructors

Response 

Fields

Instances

Instances details
Show Response Source # 
Instance details

Defined in Elasticsearch.Bulk.Response

data Action Source #

The action to be taken with the document.

Constructors

Create

Create a new document. Fails if document with ID already exists.

Index

Create or update a document.

Delete

Delete a document. Note: Currently broken. Results in malformed request.

Update

Update a document. Fails if document with ID does not exist.

Instances

Instances details
Show Action Source # 
Instance details

Defined in Elasticsearch.Bulk.Request

data Item Source #

The _type field is omitted because it is always _doc in Elasticsearch 7+. Some other fields are omitted because they are only present when an operation succeeds.

Constructors

Item 

Fields

Instances

Instances details
Show Item Source # 
Instance details

Defined in Elasticsearch.Bulk.Response

Methods

showsPrec :: Int -> Item -> ShowS #

show :: Item -> String #

showList :: [Item] -> ShowS #

data Error Source #

Constructors

Error 

Fields

Instances

Instances details
Show Error Source # 
Instance details

Defined in Elasticsearch.Bulk.Response

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

data Details Source #

An item has different fields depending on whether the operation was considered to have succeeded.

Instances

Instances details
Show Details Source # 
Instance details

Defined in Elasticsearch.Bulk.Response

Response Parser

parser :: Value -> Parser Response Source #

Decode the JSON response to a bulk request.

Example Data

Example responses from Elasticsearch documentation with additional commentary. This one does not include any detailed error messages:

{
  "took": 30,
  "errors": false,
  "items": [
    {
      "index": {
        "_index": "test",
        "_type": "_doc",
        "_id": "1",
        "_version": 1,
        "result": "created",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "status": 201,
        "_seq_no" : 0,
        "_primary_term": 1
      }
    },
    {
      "delete": {
        "_index": "test",
        "_type": "_doc",
        "_id": "2",
        "_version": 1,
        "result": "not_found",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "status": 404,
        "_seq_no" : 1,
        "_primary_term" : 2
      }
    }
  ]
}

This one does have detailed error messages in it:

{
  "took": 486,
  "errors": true,
  "items": [
    {
      "update": {
        "_index": "index1",
        "_type" : "_doc",
        "_id": "5",
        "status": 404,
        "error": {
          "type": "document_missing_exception",
          "reason": "[_doc][5]: document missing",
          "index_uuid": "aAsFqTI0Tc2W0LCWgPNrOA",
          "shard": "0",
          "index": "index1"
        }
      }
    },
    {
      "update": {
        "_index": "index1",
        "_type" : "_doc",
        "_id": "6",
        "status": 404,
        "error": {
          "type": "document_missing_exception",
          "reason": "[_doc][6]: document missing",
          "index_uuid": "aAsFqTI0Tc2W0LCWgPNrOA",
          "shard": "0",
          "index": "index1"
        }
      }
    },
    {
      "create": {
        "_index": "index1",
        "_type" : "_doc",
        "_id": "7",
        "_version": 1,
        "result": "created",
        "_shards": {
          "total": 2,
          "successful": 1,
          "failed": 0
        },
        "_seq_no": 0,
        "_primary_term": 1,
        "status": 201
      }
    }
  ]
}

Even though the documentation shows an index_uuid field in the error details, Elasticsearch 7.10 does not always populate this field. It is not terribly useful, so it is omitted from the Error type.