Home » Enterprise Java » Apache Solr » Apache Solr on Docker Example

About Kevin Yang

A software design and development professional with seventeen years’ experience in the IT industry, especially with Java EE and .NET, I have worked for software companies, scientific research institutes and websites.

Apache Solr on Docker Example

In this article, we will show you an example about Apache Solr on Docker.

1. Introduction

Apache Solr is a popular open-source search platform built on Apache Lucene. Docker is the leading container platform that allows developers to isolate their app from its environment by packaging software into standardized units for development, shipment, and deployment. In this example, we are going to show you how to run Solr on Docker.

 

2. Technologies Used

The steps and commands described in this example are for Apache Solr 8.5.2, Docker Desktop and Docker Compose on Windows 10 Pro. The official Solr docker image solr:8.5.2 and the official ZooKeeper docker image zookeeper:3.6.1 are used in the example.

3. Running Solr on Docker

3.1 Install Docker Desktop

Download the stable version of Docker Desktop for Windows from here. Run the Docker Desktop Installer.exe to install Docker Desktop. Note that your machine must have the following features for Docker Desktop to function correctly:

  • Hyper-V installed and working
  • Virtualization enabled in the BIOS

You can following the troubleshooting instructions if you have problems during the installation. Docker Desktop for Windows also includes Compose along with other Docker apps, so most Windows users do not need to install Compose separately.

3.2 Running Standalone Solr on Docker

Running a standalone Solr instance on Docker is a convenient way for developer. It also could be an option for production use for simple scenarios. We can run it with docker directly or by using docker-compose.

3.2.1 Running With Docker Run

First of all, we need to create a local directory to store Solr data. Open a command prompt and run the command below to create a directory data:

mkdir data

Then run the following command to start Solr:

docker run -d -v "%CD%/data:/var/solr" -p 8983:8983 --name jcg_solr solr:8.5.2 solr-precreate jcg_example_core

The docker run command first creates a writable container layer over the specified image solr:8.5.2, and then starts it using the specified command solr-precreate. For the first run, docker will pull the solr:8.5.2 docker image from Docker Hub which may take a while to finish. solr-precreate is a shell script to create a core on disk and then run Solr in the foreground. jcg_example_core is the core name passed to solr-precreate command as a parameter. You can find its source code here. We use -v option to bind the mounted local directory data to /var/solr. The -d option is same as --detach which means to run the container in background and print the container ID. The -p option with a pair of port numbers means to publish the container’s port 8983 to the host port 8983. Port 8983 is the default port used by Solr when running. And --name option is used to assign a name jcg_solr to the container.

The output would be:

Unable to find image 'solr:8.5.2' locally
8.5.2: Pulling from library/solr
...
73976b624471: Pull complete
56d6fac640ef: Pull complete
Digest: sha256:4d7e36d4ad306c0465fe14a7ede8078492e39ccb52e6f3d96fa5cadcf4d68fb6
Status: Downloaded newer image for solr:8.5.2
fc2fe4413f44cc19e318aed61138d0300bcb8e0c3653158a9f8dd9a24fd9aeff

The last line fc2fe4413f44cc19e318aed61138d0300bcb8e0c3653158a9f8dd9a24fd9aeff is the full container ID we just started and we can use the docker ps command to see it:

docker ps --no-trunc
CONTAINER ID                                                       IMAGE               COMMAND                                                  CREATED             STATUS              PORTS                    NAMES
fc2fe4413f44cc19e318aed61138d0300bcb8e0c3653158a9f8dd9a24fd9aeff   solr:8.5.2          "docker-entrypoint.sh solr-precreate jcg_example_core"   6 minutes ago       Up 6 minutes        0.0.0.0:8983->8983/tcp   jcg_solr

Then we can open a browser and go to http://localhost:8983/ to see the Solr Admin Console. Also from the “Core Selector” drop-down list, we can see the jcg_example_core.

3.2.2 Running With Docker Compose

Docker Compose is a tool we can use to define and run multi-container Docker applications with a YAML file configuration and a single command.

To run a single standalone Solr instance, we can firstly define a docker-compose.yml file as below:

version: '3.8'
services:
  jcg_solr:
    container_name: jcg_solr
    image: solr:8.5.2
    ports:
     - "8983:8983"
    volumes:
      - data:/var/solr
    command:
      - solr-precreate
      - jcg_example_core
volumes:
  data:

Note that we use Docker Volumes instead of host-mounted directories. For more information of how to use volumes, please follow this link.

Then run the command below in the same directory where the docker-compose.yml is saved to start the jcg_solr container:

docker-compose up -d

The output would be:

Creating network "docker_default" with the default driver
Creating volume "docker_data" with default driver
Creating docker_jcg_solr_1 ... done                                             

Then we can check the running container as below:

docker ps --no-trunc
CONTAINER ID                                                       IMAGE               COMMAND                                                  CREATED             STATUS              PORTS                    NAMES
7911ad0bb46490a3b79e71188bf49ca9d9e2b1ed0a70a210f1a1b35d4502f6d7   solr:8.5.2          "docker-entrypoint.sh solr-precreate jcg_example_core"   47 seconds ago      Up 44 seconds       0.0.0.0:8983->8983/tcp   jcg_solr

3.2.3 Creating a Core

In standalone mode, Solr cores are used to store data. In previous sections, you may have noticed that we create a core by specifying the solr-precreate <core-name> command at container start up. This is a very convenient way to create a core and also it is much easier to turn it into configuration for Docker Compose and orchestration tools like Kubernetes. One thing needs to be mentioned is that the solr-precreate command takes an optional extra argument to specify a configset directory in /opt/solr/server/solr/configsets/. This allows us to specify our own config when creating a core. For example, assuming we have our jcg_example_configs configset in a local directory, to use this to create a core, we need to mount this configset into the container as below:

docker run -d -v "D:/Java/solr-8.5.2/server/solr/configsets/jcg_example_configs:/opt/solr/server/solr/configsets/jcg_example_configs" -v "%CD%/data:/var/solr" -p 8983:8983 --name jcg_solr solr:8.5.2 solr-precreate jcg_example_core /opt/solr/server/solr/configsets/jcg_example_configs

The output would be the container ID:

12c681558d269e4d2ec7d0ebce23f0bc03cc3a6d0d6e695d23bc279fa4c83b1b

Then we can check the running container as below:

docker ps --no-trunc
CONTAINER ID                                                       IMAGE               COMMAND                                                                                                       CREATED             STATUS              PORTS                    NAMES
12c681558d269e4d2ec7d0ebce23f0bc03cc3a6d0d6e695d23bc279fa4c83b1b   solr:8.5.2          "docker-entrypoint.sh solr-precreate jcg_example_core /opt/solr/server/solr/configsets/jcg_example_configs"   15 seconds ago      Up 12 seconds       0.0.0.0:8983->8983/tcp   jcg_solr

To make sure the jcg_example_core has been created by using jcg_example_configs, we can open a browser and go to http://localhost:8983/ to see the Solr Admin Console. Select the jcg_exmaple_core from the “Core Selector” drop-down list, then navigate to “Schema” page and we should be able to find custom fields we defined in the managed_schema of the jcg_example_configs such as id, author, title, etc.

3.2.4 Loading Data

There are several ways to load data. We are going to show you an example of loading data into the jcg_example_core we just created in the previous section by using a separate Docker container. Download the zip file attached to this article and unziparticles.csv into a local directory mydata. Run the command below will load the CSV file into jcg_example_core.

docker run --rm -v "%CD%/mydata:/mydata" --network=host solr:8.5.2 post -c jcg_example_core /mydata/articles.csv

The output would be:

/usr/local/openjdk-11/bin/java -classpath /opt/solr/dist/solr-core-8.5.2.jar -Dauto=yes -Dc=jcg_example_core -Ddata=files org.apache.solr.util.SimplePostTool /mydata/articles.csv
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/jcg_example_core/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file articles.csv (text/csv) to [base]
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/jcg_example_core/update...
Time spent: 0:00:01.350

The idea behind this is using a separate Docker container, with a mounted volume /mydata containing the data, using the host network to connect to the mapped port 8983 of the running Docker container. Then invoke the SimplePostTool to index the articles.csv.

Now we can run a query to find articles written by Kevin Yang in jcg_example_core:

curl http://localhost:8983/solr/jcg_example_core/select --data-urlencode "q=author:\"Kevin Yang\""

There are 7 articles found as below:

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"author:\"Kevin Yang\""}},
  "response":{"numFound":7,"start":0,"docs":[
      {
        "id":"0553573333",
        "category":"java",
        "title":"Java Array Example",
        "published":true,
        "author":"Kevin Yang",
        "views":[2560],
        "likes":[256],
        "dislikes":[6],
        "comments":[3],
        "publish_date":["2020-05-06T00:00:00Z"],
        "_version_":1674816123321712640},
      {
        "id":"0626166238",
        "category":"java",
        "title":"Java Arrays Showcases",
        "published":true,
        "author":"Kevin Yang",
        "views":[565],
        "likes":[234],
        "dislikes":[8],
        "comments":[14],
        "publish_date":["2020-03-06T00:00:00Z"],
        "_version_":1674816123495776256},
      {
        "id":"0221234283",
        "category":"java",
        "title":"Java ArrayList 101",
        "published":true,
        "author":"Kevin Yang",
        "views":[875],
        "likes":[65],
        "dislikes":[2],
        "comments":[2],
        "publish_date":["2020-03-13T00:00:00Z"],
        "_version_":1674816123497873408},
      {
        "id":"0553579908",
        "category":"java",
        "title":"Java Remote Method Invocation Example",
        "published":true,
        "author":"Kevin Yang",
        "views":[389],
        "likes":[26],
        "dislikes":[3],
        "comments":[0],
        "publish_date":["2010-05-23T00:00:00Z"],
        "_version_":1674816123502067712},
      {
        "id":"0563881328",
        "category":"java",
        "title":"Thread",
        "published":true,
        "author":"Kevin Yang",
        "views":[1689],
        "likes":[360],
        "dislikes":[10],
        "comments":[20],
        "publish_date":["2020-03-01T00:00:00Z"],
        "_version_":1674816123504164864},
      {
        "id":"055357342Y",
        "category":"java",
        "title":"Java StringTokenizer Example",
        "published":true,
        "author":"Kevin Yang",
        "views":[699],
        "likes":[30],
        "dislikes":[0],
        "comments":[0],
        "publish_date":["2020-06-01T00:00:00Z"],
        "_version_":1674816123505213440},
      {
        "id":"0818231712",
        "category":"solr",
        "title":"Apache SolrCloud Example",
        "published":true,
        "author":"Kevin Yang",
        "views":[2000],
        "likes":[1000],
        "dislikes":[10],
        "comments":[200],
        "publish_date":["2020-06-05T00:00:00Z"],
        "_version_":1674816123509407744}]
  }}

3.3. Running SolrCloud On Docker

You may have already read the Apache Solr Clustering Example and have a basic understanding of what a SolrCloud is. You may also know how to run a SolrCloud with two Solr nodes and an embedded ZooKeeper instance on your local machine. But running a SolrCloud on Docker is different. As there are multiple containers need to be run, Docker Compose would be a good tool for it.

3.3.1 An Example Docker Compose File

First of all, let’s create a docker compose file docker-compose-solrcloud.yml which defines the components of a SolrCloud: two ZooKeeper nodes and three Solr nodes.

# a docker compose yml file to start a SolrCloud with two ZooKeeper nodes and three Solr nodes.
version: '3.8'
services:
  solr1:
    image: solr:8.5.2
    container_name: solr1
    ports:
     - "8981:8983"
    environment:
      - ZK_HOST=zoo1:2181,zoo2:2181
    networks:
      - solr
    depends_on:
      - zoo1
      - zoo2

  solr2:
    image: solr:8.5.2
    container_name: solr2
    ports:
     - "8982:8983"
    environment:
      - ZK_HOST=zoo1:2181,zoo2:2181
    networks:
      - solr
    depends_on:
      - zoo1
      - zoo2

  solr3:
    image: solr:8.5.2
    container_name: solr3
    ports:
     - "8983:8983"
    environment:
      - ZK_HOST=zoo1:2181,zoo2:2181
    networks:
      - solr
    depends_on:
      - zoo1
      - zoo2

  zoo1:
    image: zookeeper:3.6.1
    container_name: zoo1
    restart: always
    hostname: zoo1
    ports:
      - 2181:2181
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zoo2:2888:3888;2181
    networks:
      - solr

  zoo2:
    image: zookeeper:3.6.1
    container_name: zoo2
    restart: always
    hostname: zoo2
    ports:
      - 2182:2181
    environment:
      ZOO_MY_ID: 2
      ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=0.0.0.0:2888:3888;2181
    networks:
      - solr

networks:
  solr:

3.3.2 Starting the SolrCloud

Run the command below to start the SolrCloud:

docker-compose -f docker-compose-solrcloud.yml up

The -f option allows us to specify a docker compose file other than the default file docker-compose.yml.

The output is verbose and lengthy so we just keep some important lines of it for simplicity as below:

Starting zoo2 ... done
Starting zoo1 ... done
Starting solr1 ... done
Starting solr2 ... done
Starting solr3 ... done
...
zoo2     | 2020-08-11 12:35:13,467 [myid:2] - INFO  [main:Server@399] - Started @2092ms
zoo2     | 2020-08-11 12:35:13,563 [myid:2] - INFO  [QuorumPeer[myid=2](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1371] - LOOKING
zoo2     | 2020-08-11 12:35:13,567 [myid:2] - INFO  [QuorumPeer[myid=2](plain=0.0.0.0:2181)(secure=disabled):FastLeaderElection@944] - New election. My id = 2, proposed zxid=0x200000025
zoo1     | 2020-08-11 12:35:13,995 [myid:1] - INFO  [main:Server@399] - Started @2156ms
zoo1     | 2020-08-11 12:35:14,066 [myid:1] - INFO  [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1371] - LOOKING
zoo1     | 2020-08-11 12:35:14,068 [myid:1] - INFO  [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):FastLeaderElection@944] - New election. My id = 1, proposed zxid=0x200000025
zoo2     | 2020-08-11 12:35:14,345 [myid:2] - INFO  [QuorumPeer[myid=2](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1465] - LEADING
zoo1     | 2020-08-11 12:35:14,354 [myid:1] - INFO  [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1453] - FOLLOWING
zoo1     | 2020-08-11 12:35:14,387 [myid:1] - INFO  [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):Follower@75] - FOLLOWING - LEADER ELECTION TOOK - 318 MS
zoo2     | 2020-08-11 12:35:14,395 [myid:2] - INFO  [QuorumPeer[myid=2](plain=0.0.0.0:2181)(secure=disabled):Leader@581] - LEADING - LEADER ELECTION TOOK - 828 MS
...
solr3    | 2020-08-11 12:32:36.585 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter  ___      _       Welcome to Apache Solr? version 8.5.2
solr3    | 2020-08-11 12:32:36.595 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in cloud mode on port 8983
solr3    | 2020-08-11 12:32:36.596 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter \__ \/ _ \ | '_|  Install dir: /opt/solr
solr3    | 2020-08-11 12:32:36.596 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter |___/\___/_|_|    Start time: 2020-08-11T12:32:36.596394Z
solr3    | 2020-08-11 12:32:37.411 INFO  (main) [   ] o.a.s.c.c.ConnectionManager Client is connected to ZooKeeper
solr2    | 2020-08-11 12:32:38.286 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter  ___      _       Welcome to Apache Solr? version 8.5.2
solr2    | 2020-08-11 12:32:38.302 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in cloud mode on port 8983
solr2    | 2020-08-11 12:32:38.303 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter \__ \/ _ \ | '_|  Install dir: /opt/solr
solr2    | 2020-08-11 12:32:38.304 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter |___/\___/_|_|    Start time: 2020-08-11T12:32:38.304281Z
solr1    | 2020-08-11 12:32:39.030 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in cloud mode on port 8983
solr1    | 2020-08-11 12:32:39.031 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter \__ \/ _ \ | '_|  Install dir: /opt/solr
solr1    | 2020-08-11 12:32:39.032 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter |___/\___/_|_|    Start time: 2020-08-11T12:32:39.032070Z
solr2    | 2020-08-11 12:32:39.043 INFO  (main) [   ] o.a.s.c.c.ConnectionManager Client is connected to ZooKeeper
solr1    | 2020-08-11 12:32:39.780 INFO  (main) [   ] o.a.s.c.c.ConnectionManager Client is connected to ZooKeeper
...
solr3    | 2020-08-11 12:32:43.707 INFO  (main) [   ] o.a.s.c.ZkController Register node as live in ZooKeeper:/live_nodes/172.19.0.4:8983_solr
solr3    | 2020-08-11 12:32:43.931 INFO  (zkCallback-8-thread-1) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (0) -> (1)
solr2    | 2020-08-11 12:32:44.648 INFO  (main) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (0) -> (1)
solr2    | 2020-08-11 12:32:45.008 INFO  (main) [   ] o.a.s.c.ZkController Register node as live in ZooKeeper:/live_nodes/172.19.0.5:8983_solr
solr2    | 2020-08-11 12:32:45.142 INFO  (zkCallback-8-thread-1) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (1) -> (2)
solr3    | 2020-08-11 12:32:45.176 INFO  (zkCallback-8-thread-1) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (1) -> (2)
solr1    | 2020-08-11 12:32:45.339 INFO  (main) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (0) -> (2)
solr1    | 2020-08-11 12:32:45.715 INFO  (main) [   ] o.a.s.c.ZkController Register node as live in ZooKeeper:/live_nodes/172.19.0.6:8983_solr
solr2    | 2020-08-11 12:32:45.876 INFO  (zkCallback-8-thread-1) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (2) -> (3)
solr3    | 2020-08-11 12:32:45.894 INFO  (zkCallback-8-thread-2) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (2) -> (3)
solr1    | 2020-08-11 12:32:45.894 INFO  (zkCallback-8-thread-1) [   ] o.a.s.c.c.ZkStateReader Updated live nodes from ZooKeeper... (2) -> (3)
solr3    | 2020-08-11 12:32:46.274 INFO  (main) [   ] o.e.j.s.Server Started @16854ms
solr2    | 2020-08-11 12:32:46.740 INFO  (main) [   ] o.e.j.s.Server Started @15854ms
solr1    | 2020-08-11 12:32:47.080 INFO  (main) [   ] o.e.j.s.Server Started @15881ms

We can see the following things happened from the output above:

  1. The two ZooKeeper nodes (zoo1, zoo2) formed a Leader-Follower ZooKeeper cluster.
  2. The three Solr nodes (solr1, solr2, solr3) started and connected to the ZooKeeper cluster.
  3. The three Solr nodes (solr1, solr2, solr3) registered themselves as live nodes in ZooKeeper.
  4. The five nodes (zoo1, zoo2, solr1, solr2, solr3) formed a SolrCloud cluster.

3.3.3 Creating a Collection

Collections are used to store data in a SolrCloud. There are several options to create a collection as below:

  • Solr admin UI
    Open a browser and navigate to http://localhost:8983/, select “Collections” from the left-hand side navigation menu, then press the “Add Collection” button, give it a name, select the _default config set, then press the “Add Collection” button.
  • Solr control script
    Run Solr control script on one of the containers. For example:
docker exec solr1 solr create -c jcgArticles -n _default

The output would be:

Re-using existing configuration directory _default
Created collection 'jcgArticles' with 1 shard(s), 1 replica(s) with config-set '_default'
  • Use a separate container
    Run a separate container on the same network or the SolrCloud and use create_collection command as below:
docker run -e SOLR_HOST=solr1 --network=docker_solr solr:8.5.2 solr create_collection -c jcgArticles -n _default -p 8983

The output would be:

Re-using existing configuration directory _default
Created collection 'jcgArticles' with 1 shard(s), 1 replica(s) with config-set 'jcgArticles'
  • Use the Collections API
    Invoke the Collections API with curl as below:
curl http://localhost:8983/solr/admin/collections --data-urlencode "action=create"  --data-urlencode "name=jcgArticles"  --data-urlencode "numShards=1" --data-urlencode "collection.configName=_default"

The output would be:

{
    "responseHeader":{
      "status":0,
      "QTime":2844},
    "success":{
      "172.19.0.4:8983_solr":{
        "responseHeader":{
          "status":0,
          "QTime":1739},
        "core":"jcgArticles_shard1_replica_n1"}},
    "warning":"Using _default configset. Data driven schema functionality is enabled by default, which is NOT RECOMMENDED for production use. To turn it off: curl http://{host:port}/solr/jcgArticles/config -d '{\"set-user-property\": {\"update.autoCreateFields\":\"false\"}}'"}

If you want to use a custom configset for your collection, you first need to upload it, and then refer to it by name when you create the collection. See section 3.1 Upload a ConfigSet in Apache Solr Clustering Example.

3.3.4 Loading Data

We can use the same way to load data into a SolrCloud as loading data into a standalone Solr instance we’ve demonstrated before. Run the command below to start the loading container in the same network of the running SolrCloud and load articles.csv into collection jcgArticles by connecting to the node solr1:

docker run --rm -v "%CD%/mydata:/mydata" --network=docker_solr solr:8.5.2 post -c jcgArticles /mydata/articles.csv -host solr1

The output would be:

/usr/local/openjdk-11/bin/java -classpath /opt/solr/dist/solr-core-8.5.2.jar -Dauto=yes -Dhost=solr1 -Dc=jcgArticles -Ddata=files org.apache.solr.util.SimplePostTool /mydata/articles.csv
SimplePostTool version 5.0.0
Posting files to [base] url http://solr1:8983/solr/jcgArticles/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file articles.csv (text/csv) to [base]
1 files indexed.
COMMITting Solr index changes to http://solr1:8983/solr/jcgArticles/update...
Time spent: 0:00:03.045

Similarly, we can run a query to find articles written by Kevin Yang in the collection jcgArticles:

curl http://localhost:8983/solr/jcgArticles/select --data-urlencode "q=author:\"Kevin Yang\""

There are 7 articles found as below:

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":64,
    "params":{
      "q":"author:\"Kevin Yang\""}},
  "response":{"numFound":7,"start":0,"docs":[
      {
        "id":"0553573333",
        "category":["java"],
        "title":["Java Array Example"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[2560],
        "likes":[256],
        "dislikes":[6],
        "comments":[3],
        "publish_date":["2020-05-06T00:00:00Z"],
        "_version_":1674818409072689152},
      {
        "id":"0626166238",
        "category":["java"],
        "title":["Java Arrays Showcases"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[565],
        "likes":[234],
        "dislikes":[8],
        "comments":[14],
        "publish_date":["2020-03-06T00:00:00Z"],
        "_version_":1674818409355804672},
      {
        "id":"0221234283",
        "category":["java"],
        "title":["Java ArrayList 101"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[875],
        "likes":[65],
        "dislikes":[2],
        "comments":[2],
        "publish_date":["2020-03-13T00:00:00Z"],
        "_version_":1674818409365241856},
      {
        "id":"0553579908",
        "category":["java"],
        "title":["Java Remote Method Invocation Example"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[389],
        "likes":[26],
        "dislikes":[3],
        "comments":[0],
        "publish_date":["2010-05-23T00:00:00Z"],
        "_version_":1674818409368387584},
      {
        "id":"0563881328",
        "category":["java"],
        "title":["Thread"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[1689],
        "likes":[360],
        "dislikes":[10],
        "comments":[20],
        "publish_date":["2020-03-01T00:00:00Z"],
        "_version_":1674818409372581888},
      {
        "id":"055357342Y",
        "category":["java"],
        "title":["Java StringTokenizer Example"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[699],
        "likes":[30],
        "dislikes":[0],
        "comments":[0],
        "publish_date":["2020-06-01T00:00:00Z"],
        "_version_":1674818409383067648},
      {
        "id":"0818231712",
        "category":["solr"],
        "title":["Apache SolrCloud Example"],
        "published":[true],
        "author":["Kevin Yang"],
        "views":[2000],
        "likes":[1000],
        "dislikes":[10],
        "comments":[200],
        "publish_date":["2020-06-05T00:00:00Z"],
        "_version_":1674818409398796288}]
  }}

4. Download the Example Data File

Download
You can download the example data file of this example here: Apache Solr on Docker Example

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

 

and many more ....

 

Receive Java & Developer job alerts in your Area

 

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Grumpy old coder
Grumpy old coder
5 months ago

Great article, really clear description at every stage!