WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

The following topics explain how to carry out faceted searches by extracting sub categories of one or more attributes, and how to persist data and generate events in a manner that allows such search operations to be carried out.

Persisting attributes

In order carry out faceted searches for an attribute, the Is a Facet check box should be selected for that attribute. In the example below, this check box is selected for the Author and Date attributes are persisted as facets.

Generating data

 In order to separate subcategories, the values for attributes persisted as facets should be specified as comma separated values.

In the following example, the comma (,) separated values entered for the Author attribute define a hierarchy of categories when searching by the Author facet. The first name is the main category, the second name is a sub category of the first name, etc.


Searching for Data

Click on the relevant tab to extract sub categories and perform drill down searches using the DAS Management Console or via REST API.

Follow the procedure below to search for events in an event stream by one or more attributes.

  1. In the WSO2 DAS Management Console, go to the Main tab and click Data Explorer to open the Data Explorer page.
  2. In the Table Name field, select the required event table.
  3. Select the By Query option. This displays the query field as shown below.
     
  4. To search for books by a specific faceted attribute (e.g., author), select that attribute in the Select a Facet field.
     
    As a result, a separate field is added for the attribute (the correlation_Author field in the above example).
  5. In the new field added for the facet, select a value as demonstrated in the example below. The value you select represents the main category (in this example, the first name of the author).
     
    This adds a second field for the selected facet as shown above.
  6. To extract the sub categories available for the category you selected, expand the second field as demonstrated below. In this example, it shows all the available authors whose first name is Arthur.
     
  7. Select one sub category and click Search. This carries out a drill down search and retrieves records that match both the category and the sub category.

    In this example, records where the first name of the author is Arthur and the second name is Conan are retrieved.
  8. If you want to search by two facets, select another facet as shown in the example below.
  9. Select categories and sub categories for both facets as shown in the example below, and click Search.
     This retrieves records that match the criteria specified by both facets as shown below.
     

e.g., The following cURL command can be used to extract the first names of the available authors.

curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic YWRtaW46YWRtaW4=" -v https://localhost:9443/analytics/facets -d '{"tableName" : "BookStore","fieldName" : "correlation_Author","categoryPath" : [],"query" : "*:*","scoreFunction" : "1"}' -k

This returns a response similar to the following.

{"categoryPath":[],"categoryCount":7,"categories":{"Arthur":12.0,"Margaret":8.0,"Charles":4.0,"Jane":2.0,"George":2.0,"Anthony":2.0,"Rudyard":1.0}}

  • No labels