# React with elastic search api connector returns all documents

**URL:** https://discuss.elastic.co/t/react-with-elastic-search-api-connector-returns-all-documents/358863
**Category:** Elastic Search
**Created:** [May 6, 2024, 4:59pm UTC](https://discuss.elastic.co/t/react-with-elastic-search-api-connector-returns-all-documents/358863 "2024-05-06T16:59:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Gordon\_Vidaver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gordon_vidaver/32/134182_2.png) [@Gordon\_Vidaver](https://discuss.elastic.co/u/Gordon_Vidaver)
#### Post date: [May 6, 2024, 4:59pm UTC](https://discuss.elastic.co/t/react-with-elastic-search-api-connector-returns-all-documents/358863/1 "2024-05-06T16:59:08Z")

</div>

I'm using the react-search-ui library and the ElasticsearchAPIConnector. If I type in a search term, I get **all** the documents in the index back, sorted with the hits at the top. In the examples it only returns the documents with hits. I've looked but there doesn't seem to be a way to control this behavior.

The query that gets generated has "should" fields, e.g. the following. It seems like these should be "must".

Is there a way to get the search results to only be those with hits to the search term?

Thanks!

```auto
query
: 
{bool: {should: [{multi_match: {query: "Friday",…}}, {multi_match: {query: "Friday",…}},…],…}}
bool
: 
{should: [{multi_match: {query: "Friday",…}}, {multi_match: {query: "Friday",…}},…],…}
filter
: 
[{bool: {filter: [{term: {project_id: "663541d9e8794daf0e4a6858"}}]}}]
0
: 
{bool: {filter: [{term: {project_id: "663541d9e8794daf0e4a6858"}}]}}
bool
: 
{filter: [{term: {project_id: "663541d9e8794daf0e4a6858"}}]}
should
: 
[{multi_match: {query: "Friday",…}}, {multi_match: {query: "Friday",…}},…]
0
: 
{multi_match: {query: "Friday",…}}
multi_match
: 
{query: "Friday",…}
fields
: 
["summary^1", "file_display_name^1", "notes^1", "call_transcript_asr_spa^1",…]
operator
: 
"and"
query
: 
"Friday"
type
: 
"best_fields"
...

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 3, 2024, 4:59pm UTC](https://discuss.elastic.co/t/react-with-elastic-search-api-connector-returns-all-documents/358863/2 "2024-06-03T16:59:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
