Reactivesearch: dataField for List components

Created on 23 Jan 2018  路  10Comments  路  Source: appbaseio/reactivesearch

Issue Type:
docs issue/query

Description:
It is not straightforward as to how the dataField needs to be specified for List components. For example, in case of DataSearch, the following snippet works for my data:

<DataSearch
    componentId="searchbox"
    dataField={["test", "city"]}
 />

At the same time, all the examples in the manual have a dot-separated "raw" field in dataField property. So it is not straightforward as to how this needs to be specified. The following snippet does not work for me:

<MultiList
    componentId="citybox"
    dataField="city"
/>

Infact, none of the following options fixes the issue: "city.raw", "..city", ".city", ".city.raw", "..city.raw" etc. There are no errors displayed on the console but the MultiList component is not even displayed on the UI.

When I do a hard-coded query using the URL, http://localhost:3000/?citybox=san_francisco, it throws the following error
Screenshots:
screenshot 2018-01-23 14 07 03

Reactivesearch version: x.y.z
2.1.1

Browser: [all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Chrome

Most helpful comment

It seems like you've a keyword field not raw. Can you try the dataField as industry.keyword

All 10 comments

Hi @botvsbot, can you post your mapping object? .raw here refers to a multifield in ES which is either not_analyzed or of type keyword. Reference

Hi @divyanshu013 , Thanks for your response. My field city was originally of type text. I would expect specifying the dataField as city.raw to consider it as keyword.

Nonetheless, changing the mapping to keyword fixes the issue:

{
  "my_index" : {
    "mappings" : {
      "test" : {
        "properties" : {
          "city" : {
            "type" : "keyword"
          },
        }
      }
    }
  }
}

I have a followup question. Does MultiList support filtering on multiple fields (similar to DataSearch)? Currently, I am not able to specify an array as the dataField param. What is the right component to be able to filter by multiple fields? I am not looking for text search, I am looking for an exact filter on the field keywords.

The .raw multifield is what is used by appbase. Your ES might have a different name for the keyword field. I think we can also explain this in the docs better for the components using aggregations. Since MultiList does aggregation, it needs a keyword field.

As for your followup question, MultiList only supports aggregation on a single field. You can use ReactiveComponent to create your own component in order to handle multiple fields.

Thank you. Feel free to close this.

I'm having the same issue. The MultiList/SingleList components are not showing up at all. No error handling of any kind. i'm use appbase elesticsearch.
schermafbeelding 2018-03-06 om 15 30 59

component Call
<SingleList componentId="industry" dataField="industry.raw" size={100} />

Any advice

It seems like you've a keyword field not raw. Can you try the dataField as industry.keyword

thanks, that fixed it.

How to Specify for a JSON object?

schermafbeelding 2018-03-07 om 09 04 44

dataField="classification.properties.legal.keyword"

is not returning anything

Can you try classification.legal.keyword?

thanks again 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kud picture kud  路  4Comments

willopez picture willopez  路  3Comments

dmce picture dmce  路  3Comments

vharitonsky picture vharitonsky  路  4Comments

gabzon picture gabzon  路  4Comments