Create a note using Solr

NOTE
  • Before creating a note, make sure that the Solr interpreter is configured according to the article Install a third-party interpreter.

  • The example is based on the Solr collection people_ages that contains names and age of 1000 people. The sample dataset is available for download using the direct link.

  1. In the Zeppelin web UI, click the Create new note list item or click the main menu item Notebook → Create new note.

    note phoenix 01 dark
    Adding a new note
    note phoenix 01 light
    Adding a new note
  2. In the opened dialog, enter the note name and select the default interpreter that will be used in cases when the interpreter type is not specified explicitly. Notice that you can create different folders for your notes. Then, click Create.

note solr 01 dark
Describing a new note
note solr 01 light
Describing a new note
  1. In the opened window, click the Interpreter binding icon to view the available interpreters.

    note phoenix 03 dark
    Interpreters binding
    note phoenix 03 light
    Interpreters binding
  2. Verify that the interpreter %solr is selected in the opened list; select it otherwise. Then, click Save.

    note solr 02 dark
    Saving interpreter
    note solr 02 light
    Saving interpreter
  3. In the first paragraph of your note, enter the command that sets the default collection to be selected from Solr (if any other is not defined).

    use people_ages

    Then, click Run this paragraph to execute the code.

    note solr 06 dark
    Setting the default Solr collection
    note solr 06 light
    Setting the default Solr collection
    TIP
    If you do not specify the interpreter name, the default one is used — %solr.
  4. In the second note paragraph, enter the following query. The query returns the number of people grouped by age.

    facet q=*:*&facet=true&facet.field=Age

    The result is shown below.

    note solr 04 dark
    Results table
    note solr 04 light
    Results table
  5. Click the Bar Chart icon to switch to a different view mode.

    note solr 05 dark
    A bar chart
    note solr 05 light
    A bar chart
  6. You can also use SQL statements. Enter the following code in the third paragraph:

    SELECT MIN(Age) AS Minimum, MAX(Age) AS Maximum FROM people_ages

    It returns the minimum and the maximum people age values.

    note solr 07 dark
    Running SQL query
    note solr 07 light
    Running SQL query
Found a mistake? Seleсt text and press Ctrl+Enter to report it