appbaseio / appbaseio/reactivesearch

Ability to create a custom filter not based on one of ES index mapping fields

Open
#1,474 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
4.9k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

**Affected Projects**

React

**Is your feature request related to a problem? Please describe.**

Currently I need to have a dropdown or a select menu that lets the users choose the aggregation interval, for the DataSearch custom query which performs a date_histogram aggregation.

**Describe the solution you'd like**

I would like the ability to trigger a refresh of ReactiveSearch state (= launch new up-to-date query) from outside ReactiveSearch, so that I can have my material-ui select field update search results with the aggregation interval chosen by the user.

**Describe alternatives you've considered**

I've tried using SingleDataList with my options, use a bogus datafield, and override the query with CustomQuery. It works to an extent but it is unusable since option selection in my case is mandatory, and SingleDataList defaultSelected prop does not work.

I've tried ReactiveComponent but those allows you to read from ReactiveSearch state, not change it.

I've tried setting my DataSearch as a controlled component so that form the outside I can change its value to "" and then back to its former value, to force a refresh, but it does not work, because of debounce I presume.

**Additional context**

In a more general fashion ReactiveSearch only lets you set up filters based on existing ES index mapping fields.
It is VERY hard (as is, I've been looking for hours for ways to do it and I still have no clue) to set up custom filter that propose inputs to the user and update queries based on those inputs.
There is no need to implement this in ReactiveSearch, just let React components outside ReactiveSearch trigger queries or state refresh.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the DataSearch, SingleDataList, and ReactiveComponent entry points, along with their custom-query and controlled-component behavior. Reproduce the date_histogram aggregation-interval case and compare it with the attempted external state changes. Done means an outside React control can trigger an up-to-date query and support a custom filter input not tied to an Elasticsearch mapping field.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, javascript, react
Domain
frontend, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.