Skip to content

Include common interfaces in the source code #1134

Closed
@ismail-codinglab

Description

@ismail-codinglab

🚀 Feature Proposal

I have not found an issue about this before.
It would be nice to have the common types included in the source code.
The ones that are here in this PR:
https://github.com/elastic/elasticsearch-js/pull/742/files

and use it like so:

import { Client, ApiResponse, RequestParams, SearchResponse } from '@elastic/elasticsearch';
interface CoolBody{
  cool: 'yes';
}
client
.search(params)
.then((result: ApiResponse<SearchResponse<CoolBody>>) => {

Motivation

Reduces code, maintenance, technical depth, complexity, learning curve

One argument I could think of why you wouldn't include them is if they are different per setup.
Then I would simply suggest to rename SearchResponse to DefaultSearchResponse

I can't teach my students all this workload before they can do a simple search. I want to hide this complexity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions