reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

[Lists] Search/suggestion on ES side rather than locally

Open WhoisDavid opened this issue 5 years ago • 6 comments

First, great project guys, thanks a lot for all your work on this!

Affected Projects React

Is your feature request related to a problem? Please describe. The Multilist search is limited to the set of elements in the list (size param).

Describe the solution you'd like It would be great to have a way to enable the search feature on MultiLists to do a server search instead of a local search and with something like strictSelection enabled it should be possible to add selected suggested items to the list.

Describe alternatives you've considered

  • increasing size: my index is too big to fit and it would make the UX sluggish
  • I have tried to disable search on the MultiList and use a DataSearch component instead. I guess this could be a solution but it is not great from a UX perspective (and I hit another problem which I will report in a separate issue).

A related issue: https://github.com/appbaseio/reactivesearch/issues/515 However, the "load more" feature does not solve the problem since it does not seem to filter/search (also does not work on my side - will create a separate issue as well).

WhoisDavid avatar Mar 17 '20 10:03 WhoisDavid

As a workaround if somebody's hitting the same issue: the second solution I mentioned although a little hacky works decently.

Here is a simple example: https://codesandbox.io/s/admiring-glitter-xp00j It gives better results with a phrase prefix match (see customQuery in the example).

For my use case (on a nested field) I save the current search of the DataSearch up and added a filter in transformData:

let currentSearch = "";
// ...
<DataSearch
// ...
onValueChange={value => currentOrgSearch = value.toLowerCase()}
/>
<MultiList
// ...
transformData={data =>
    currentSearch.length > 0 ?
        data.filter(item =>
            item.key.toLowerCase().includes(currentOrgSearch)
        ) : data
}
>

This is not optimal as very dependent on the expansions of the phrase prefix but it gives pretty good results.

WhoisDavid avatar Mar 20 '20 15:03 WhoisDavid

Hi @WhoisDavid I have a similar usecase, and I tried the code from the sandbox.

When searching I get an error [bool] failed to parse field [must]", seems to maybe related to the version of ES? https://github.com/Yelp/elastalert/issues/2807#issuecomment-640881868

Were you able to get it to work with a recent version of ES?

Thanks,

rgb-panda avatar Jan 31 '21 16:01 rgb-panda

Hey @karabi

Unfortunately I just ran this on 7.4.x. Looks like they have changed some of the query parsing in 7.7.

WhoisDavid avatar Feb 04 '21 17:02 WhoisDavid

Thanks that confirms my theory, I will open an issue

rgb-panda avatar Feb 10 '21 17:02 rgb-panda

@WhoisDavid customQuery seems to be working again with 3.14.1

Your suggestion worked partially for me. I'm able to search ES to get the MultiList values, however, it's still limited by the Size number on the Multilist as this is what's controlling the aggs function, so I'm missing some values.

For example, if I have 10k documents, each having an array that contains some elements (Say 5), one of which matches my query. The aggs function would aggregate over the 5, and only then dataTransform filters them out, so in that case I'm missing some items unless I set the MultiList size to something really high. Not sure if your use case was similar.

rgb-panda avatar Feb 11 '21 15:02 rgb-panda

I have also hit this issue, is there a technical limitation here?

kasvith avatar Nov 01 '23 08:11 kasvith