customQuery property

Map Function(SearchWidget searchWidget) customQuery
read / write

takes SearchWidget instance as parameter and returns the query to be applied to the dependent widgets by react prop, as defined in Elasticsearch Query DSL.

For example, the following example has two components search-widget(to render the suggestions) and result-widget(to render the results). The result-widget depends on the search-widget to update the results based on the selected suggestion. The search-widget has the customQuery prop defined that will not affect the query for suggestions(that is how customQuery is different from defaultQuery) but it'll affect the query for result-widget because of the react dependency on search-widget.

SearchWidgetConnector(
  id: "search-widget",
  dataField: ["original_title", "original_title.search"],
  customQuery: (SearchWidget searchWidget) => ({
    'timeout': '1s',
     'query': {
      'match_phrase_prefix': {
        'fieldName': {
          'query': 'hello world',
          'max_expansions': 10,
        },
      },
    },
  })
)

SearchWidgetConnector(
  id: "result-widget",
  dataField: "original_title",
  react: {
   'and': ['search-component']
  }
)

Implementation

Map Function(SearchWidget searchWidget) customQuery;