## DESCRIPTION
* The endpoint expects a json payload with 3 key-value pairs:
    + `search_key` 
    + `type`
    + `_scroll_id`

## REQUEST
* The `search_key` describes the keyword being searched for. eg: service name, username, email address, phone number
* The `type` field describes the 'search by' type. These types include:
    + services 
    + code
    + username 
    + fullname
    + email
    + phonenumber
* `_scroll_id` refers to the [_scroll_id](https://www.elastic.co/guide/en/elasticsearch/reference/current/scroll-api.html) used by elasticsearch to query docs across pages. Pass an empty string on the first call to the api and for subsequent calls based on the same search `type` pass the `scroll_id` returned by the api. 

## RESPONSE
* The endpoint returns a json response object containing the following key-value pairs:
    + `_scroll_id` 
    + `data` 
    + `total_docs`

* `data` contains all the relevant information from the search type query
* `total_docs` represents the total matches of the search type.

## RESPONSE CODES
        response code|response
        -------------|-------------
             200     | ok
             404     | No matching searches
             500     | Search api failed

## REQUEST EXAMPLES                                                     
#### SEARCH BY SERVICES
```
POST /details/search HTTP/1.1
Host: all-service-users-internal.snwolley.com
Content-Length: 77
 
{
    "search_key" : "deywuro-sms",
    "type" : "services",
    "_scroll_id" : ""
}
```



#### SEARCH BY USERNAME
```
POST /details/search HTTP/1.1
Host: all-service-users-internal.snwolley.com
Content-Length: 77
 
{
    "search_key" : "npontutech",
    "type" : "username",
    "_scroll_id" : ""
}
```

## RESPONSE EXAMPLE
```
{
  "code": 200,
  "data": {
    "_scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFnVIWnVad0JVUWd5eklWVk1NMnV1R3cAAAAAAADLwBZHN0NjNTNrSVJGYVI3UVZvYWVTcHRn",
    "dict": [
      {
        "code": "*899*24#",
        "created_at": "2020-05-06T07:03:45+00:00",
        "deleted_at": "None",
        "email": "eamenyedzie@npontu.com",
        "fullname": "Npontu Technologies",
        "id": 11802,
        "phone_number": "233245664067",
        "services": [
          "deywuro-sms",
          "dynamic-ussd"
        ],
        "status": "active",
        "updated_at": "2020-06-05T12:50:00+00:00",
        "username": "npontutech"
      }
    ],
    "total_docs": 1
  }
}
```

