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

Elasticsearch.Search.Response

Description

Responses from Search API (http://elasticsearch.example.com/{index}/_search)

Synopsis

Types

data Response Source #

A response from a search.

One strange thing about the organization of the response is that there is a hits field with another hits field inside of it. This is how elasticsearch presents this information, and that unusual structure is simply mirrored by these types.

Constructors

Response 

Fields

Instances

Instances details
Show Response Source # 
Instance details

Defined in Elasticsearch.Search.Response

data Hits Source #

Constructors

Hits 

Fields

Instances

Instances details
Show Hits Source # 
Instance details

Defined in Elasticsearch.Search.Response

Methods

showsPrec :: Int -> Hits -> ShowS #

show :: Hits -> String #

showList :: [Hits] -> ShowS #

data Hit Source #

A document that matched the search criteria

Constructors

Hit 

Fields

Instances

Instances details
Show Hit Source # 
Instance details

Defined in Elasticsearch.Search.Response

Methods

showsPrec :: Int -> Hit -> ShowS #

show :: Hit -> String #

showList :: [Hit] -> ShowS #

data Total Source #

Constructors

Total 

Fields

Instances

Instances details
Show Total Source # 
Instance details

Defined in Elasticsearch.Search.Response

Methods

showsPrec :: Int -> Total -> ShowS #

show :: Total -> String #

showList :: [Total] -> ShowS #

Response Parser

parser :: Value -> Parser Response Source #

Decode the JSON response to a bulk request.

Example Data

Example response from Elasticsearch documentation:

{
  "took": 5,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 20,
      "relation": "eq"
    },
    "max_score": 1.3862942,
    "hits": [
      {
        "_index": "my-index-000001",
        "_type" : "_doc",
        "_id": "0",
        "_score": 1.3862942,
        "_source": {
          "@timestamp": "2099-11-15T14:12:12",
          "http": {
            "request": {
              "method": "get"
            },
            "response": {
              "status_code": 200,
              "bytes": 1070000
            },
            "version": "1.1"
          },
          "source": {
            "ip": "127.0.0.1"
          },
          "message": "GET /search HTTP/1.1 200 1070000",
          "user": {
            "id": "kimchy"
          }
        }
      }
    ]
  }
}