kibana/examples/search_examples
Nathan Reese 0113eb74c8
remove unneeded usages of isErrorResponse (#164609)
`data.search` uses
[poll_search](https://github.com/elastic/kibana/blob/main/src/plugins/data/common/search/poll_search.ts)
to fetch data. `poll_search` checks for `isErrorResponse` and throws
when`isErrorResponse` is true. **Note** `searchSource.search` uses
`data.search` to perform searches.

```javascript
   return from(search()).pipe(
      expand(() => {
        const elapsedTime = Date.now() - startTime;
        return timer(getPollInterval(elapsedTime)).pipe(switchMap(search));
      }),
      tap((response) => {
        if (isErrorResponse(response)) {
          throw response ? new Error('Received partial response') : new AbortError();
        }
      }),
      takeWhile<Response>(isPartialResponse, true),
      takeUntil<Response>(aborted$)
    );
```

Subscribers to `data.search` and `searchSource.search` do not need to
check for `isErrorResponse` in `next`. `poll_search` has already thrown
then the response is `isErrorResponse` so these checks are dead code
blocks that are never executed.

This PR removes these dead code blocks. Breaking this change out of
https://github.com/elastic/kibana/pull/164506 so that it can be reviewed
in isolated.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-28 11:40:26 -06:00
..
common fix all violations 2022-04-16 01:37:30 -05:00
public remove unneeded usages of isErrorResponse (#164609) 2023-08-28 11:40:26 -06:00
server [Search Sessions] Fix flaky partial results test in search examples (#155816) 2023-04-27 20:27:59 -03:00
kibana.jsonc [packages] migrate all plugins to packages (#148130) 2023-02-08 21:06:50 -06:00
README.md Migrates search example mountReactNode to kibana-react toMountPoint (#137633) 2022-08-01 07:52:20 -07:00
tsconfig.json [Shared UX] Adoption of Shared UX Route component (#150357) 2023-02-14 19:25:04 +00:00

search_examples

An awesome Kibana plugin

Small demos of search functionality.

To run this example, ensure you have data to search against (for example, the sample datasets) and start kibana with the --run-examples flag.


Development

See the kibana contributing guide for instructions setting up your development environment.