You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "@Nandan@" <na...@gmail.com> on 2018/02/06 02:45:48 UTC

Reg:- Create Solr Core Using Command Line

Hi ,
This question might be very basic, but need to clarify my basic
understanding.
I am using Solr Version 7.2.1
I have one CSV file named as books_data.csv which contains 20000 records.
Now I want to create solr core to start my basic search using Solr UI.
Steps which I Follow :-
1) Go to bin directory and start solr
C:\solr\bin>solr start -p 8983
2) books_data.csv is in C:\solr location
3) Now I try to create solr core.
C:\solr\bin>solr create_core -c books_data -d C:\solr
Got Error :- No Conf Sub folder or Solrconfig.xml file present.
4) Then I created folder "books_data" in C:\solr location and Created conf
subfolder under books_data folder and put solrconfig.xml inside conf
subfolder.
5) Again start to execute query
C:\solr\bin>solr create_core -c books_data -d C:\solr\books_data
Got Error :- Already core existed.
When I checked Solr Admin UI , showing error message as
SolrCore Initialization Failures

   - *books_data:*
   org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
   Could not load conf for core books_data: Error loading solr config from
   C:\solr\bin\books_data\conf\solrconfig.xml


Please tell me where am I doing wrong?
Thanks.

Re: Reg:- Create Solr Core Using Command Line

Posted by "@Nandan@" <na...@gmail.com>.
Hi Abhishek,
In my conf sub directory, I put only solrconfig.xml file as per error I was
getting.
I didn't put any other file .

Please check .

Thanks

On Tue, Feb 6, 2018 at 12:57 PM, abhi Abhishek <ab...@gmail.com> wrote:

> Hello,
>     I followed the steps outlined in your mail. i was able to get a running
> core up fine. only thing I can think of in your case is the config
> directory having all the required files for the SOLR Core to get
> initialized. can you check if you have all the SOLR config files in the
> config directory ( i.e, schema.xml, solrconfig.xml, also various supporting
> files referred in the schema.xml) you specified on the command line?
>
> can you share the conf directory, if you can?
>
> Cheers!
> Abhishek
>
> On Tue, Feb 6, 2018 at 9:30 AM, @Nandan@ <na...@gmail.com>
> wrote:
>
> > Hi Sadiki,
> > I checked Sample Techproduct Conf folder. Inside that folder, there are
> > numerous files. So Again my question will be how those files came.
> > I want to create core from Scratch and want to check and create each and
> > every config files from my sides. Then only I can able to understand what
> > and which files needs in different solr search function.
> > I hope you can understand my query.
> >
> > Thanks
> >
> > On Tue, Feb 6, 2018 at 11:48 AM, Sadiki Latty <sl...@uottawa.ca> wrote:
> >
> > > If I'm not mistaken the command requires that the books_data folder
> > > already exists with a conf folder inside and the various required files
> > > (solrconfig.xml, solr.xml,etc). To get an idea of what you should have
> in
> > > your conf folder you can check out the included configsets
> > > (sample_techproducts_configs for example). These configsets have the
> > > required files and you can copy and modify to accommodate your own
> > needs. I
> > > am not 100% sure where to find them on a windows installation but I
> > believe
> > > it would be C:\solr\server\configsets\  or another subfolder of the
> > server
> > > folder.
> > >
> > > -----Original Message-----
> > > From: @Nandan@ [mailto:nandanpriyadarshi298@gmail.com]
> > > Sent: Monday, February 5, 2018 9:46 PM
> > > To: solr-user@lucene.apache.org
> > > Subject: Reg:- Create Solr Core Using Command Line
> > >
> > > Hi ,
> > > This question might be very basic, but need to clarify my basic
> > > understanding.
> > > I am using Solr Version 7.2.1
> > > I have one CSV file named as books_data.csv which contains 20000
> records.
> > > Now I want to create solr core to start my basic search using Solr UI.
> > > Steps which I Follow :-
> > > 1) Go to bin directory and start solr
> > > C:\solr\bin>solr start -p 8983
> > > 2) books_data.csv is in C:\solr location
> > > 3) Now I try to create solr core.
> > > C:\solr\bin>solr create_core -c books_data -d C:\solr Got Error :- No
> > Conf
> > > Sub folder or Solrconfig.xml file present.
> > > 4) Then I created folder "books_data" in C:\solr location and Created
> > conf
> > > subfolder under books_data folder and put solrconfig.xml inside conf
> > > subfolder.
> > > 5) Again start to execute query
> > > C:\solr\bin>solr create_core -c books_data -d C:\solr\books_data Got
> > Error
> > > :- Already core existed.
> > > When I checked Solr Admin UI , showing error message as SolrCore
> > > Initialization Failures
> > >
> > >    - *books_data:*
> > >    org.apache.solr.common.SolrException:org.apache.solr.
> > > common.SolrException:
> > >    Could not load conf for core books_data: Error loading solr config
> > from
> > >    C:\solr\bin\books_data\conf\solrconfig.xml
> > >
> > >
> > > Please tell me where am I doing wrong?
> > > Thanks.
> > >
> >
>

Re: Reg:- Create Solr Core Using Command Line

Posted by abhi Abhishek <ab...@gmail.com>.
Hello,
    I followed the steps outlined in your mail. i was able to get a running
core up fine. only thing I can think of in your case is the config
directory having all the required files for the SOLR Core to get
initialized. can you check if you have all the SOLR config files in the
config directory ( i.e, schema.xml, solrconfig.xml, also various supporting
files referred in the schema.xml) you specified on the command line?

can you share the conf directory, if you can?

Cheers!
Abhishek

On Tue, Feb 6, 2018 at 9:30 AM, @Nandan@ <na...@gmail.com>
wrote:

> Hi Sadiki,
> I checked Sample Techproduct Conf folder. Inside that folder, there are
> numerous files. So Again my question will be how those files came.
> I want to create core from Scratch and want to check and create each and
> every config files from my sides. Then only I can able to understand what
> and which files needs in different solr search function.
> I hope you can understand my query.
>
> Thanks
>
> On Tue, Feb 6, 2018 at 11:48 AM, Sadiki Latty <sl...@uottawa.ca> wrote:
>
> > If I'm not mistaken the command requires that the books_data folder
> > already exists with a conf folder inside and the various required files
> > (solrconfig.xml, solr.xml,etc). To get an idea of what you should have in
> > your conf folder you can check out the included configsets
> > (sample_techproducts_configs for example). These configsets have the
> > required files and you can copy and modify to accommodate your own
> needs. I
> > am not 100% sure where to find them on a windows installation but I
> believe
> > it would be C:\solr\server\configsets\  or another subfolder of the
> server
> > folder.
> >
> > -----Original Message-----
> > From: @Nandan@ [mailto:nandanpriyadarshi298@gmail.com]
> > Sent: Monday, February 5, 2018 9:46 PM
> > To: solr-user@lucene.apache.org
> > Subject: Reg:- Create Solr Core Using Command Line
> >
> > Hi ,
> > This question might be very basic, but need to clarify my basic
> > understanding.
> > I am using Solr Version 7.2.1
> > I have one CSV file named as books_data.csv which contains 20000 records.
> > Now I want to create solr core to start my basic search using Solr UI.
> > Steps which I Follow :-
> > 1) Go to bin directory and start solr
> > C:\solr\bin>solr start -p 8983
> > 2) books_data.csv is in C:\solr location
> > 3) Now I try to create solr core.
> > C:\solr\bin>solr create_core -c books_data -d C:\solr Got Error :- No
> Conf
> > Sub folder or Solrconfig.xml file present.
> > 4) Then I created folder "books_data" in C:\solr location and Created
> conf
> > subfolder under books_data folder and put solrconfig.xml inside conf
> > subfolder.
> > 5) Again start to execute query
> > C:\solr\bin>solr create_core -c books_data -d C:\solr\books_data Got
> Error
> > :- Already core existed.
> > When I checked Solr Admin UI , showing error message as SolrCore
> > Initialization Failures
> >
> >    - *books_data:*
> >    org.apache.solr.common.SolrException:org.apache.solr.
> > common.SolrException:
> >    Could not load conf for core books_data: Error loading solr config
> from
> >    C:\solr\bin\books_data\conf\solrconfig.xml
> >
> >
> > Please tell me where am I doing wrong?
> > Thanks.
> >
>

Re: Reg:- Create Solr Core Using Command Line

Posted by "@Nandan@" <na...@gmail.com>.
Hi Sadiki,
I checked Sample Techproduct Conf folder. Inside that folder, there are
numerous files. So Again my question will be how those files came.
I want to create core from Scratch and want to check and create each and
every config files from my sides. Then only I can able to understand what
and which files needs in different solr search function.
I hope you can understand my query.

Thanks

On Tue, Feb 6, 2018 at 11:48 AM, Sadiki Latty <sl...@uottawa.ca> wrote:

> If I'm not mistaken the command requires that the books_data folder
> already exists with a conf folder inside and the various required files
> (solrconfig.xml, solr.xml,etc). To get an idea of what you should have in
> your conf folder you can check out the included configsets
> (sample_techproducts_configs for example). These configsets have the
> required files and you can copy and modify to accommodate your own needs. I
> am not 100% sure where to find them on a windows installation but I believe
> it would be C:\solr\server\configsets\  or another subfolder of the server
> folder.
>
> -----Original Message-----
> From: @Nandan@ [mailto:nandanpriyadarshi298@gmail.com]
> Sent: Monday, February 5, 2018 9:46 PM
> To: solr-user@lucene.apache.org
> Subject: Reg:- Create Solr Core Using Command Line
>
> Hi ,
> This question might be very basic, but need to clarify my basic
> understanding.
> I am using Solr Version 7.2.1
> I have one CSV file named as books_data.csv which contains 20000 records.
> Now I want to create solr core to start my basic search using Solr UI.
> Steps which I Follow :-
> 1) Go to bin directory and start solr
> C:\solr\bin>solr start -p 8983
> 2) books_data.csv is in C:\solr location
> 3) Now I try to create solr core.
> C:\solr\bin>solr create_core -c books_data -d C:\solr Got Error :- No Conf
> Sub folder or Solrconfig.xml file present.
> 4) Then I created folder "books_data" in C:\solr location and Created conf
> subfolder under books_data folder and put solrconfig.xml inside conf
> subfolder.
> 5) Again start to execute query
> C:\solr\bin>solr create_core -c books_data -d C:\solr\books_data Got Error
> :- Already core existed.
> When I checked Solr Admin UI , showing error message as SolrCore
> Initialization Failures
>
>    - *books_data:*
>    org.apache.solr.common.SolrException:org.apache.solr.
> common.SolrException:
>    Could not load conf for core books_data: Error loading solr config from
>    C:\solr\bin\books_data\conf\solrconfig.xml
>
>
> Please tell me where am I doing wrong?
> Thanks.
>

RE: Reg:- Create Solr Core Using Command Line

Posted by Sadiki Latty <sl...@uottawa.ca>.
If I'm not mistaken the command requires that the books_data folder already exists with a conf folder inside and the various required files (solrconfig.xml, solr.xml,etc). To get an idea of what you should have in your conf folder you can check out the included configsets (sample_techproducts_configs for example). These configsets have the required files and you can copy and modify to accommodate your own needs. I am not 100% sure where to find them on a windows installation but I believe it would be C:\solr\server\configsets\  or another subfolder of the server folder.

-----Original Message-----
From: @Nandan@ [mailto:nandanpriyadarshi298@gmail.com] 
Sent: Monday, February 5, 2018 9:46 PM
To: solr-user@lucene.apache.org
Subject: Reg:- Create Solr Core Using Command Line

Hi ,
This question might be very basic, but need to clarify my basic understanding.
I am using Solr Version 7.2.1
I have one CSV file named as books_data.csv which contains 20000 records.
Now I want to create solr core to start my basic search using Solr UI.
Steps which I Follow :-
1) Go to bin directory and start solr
C:\solr\bin>solr start -p 8983
2) books_data.csv is in C:\solr location
3) Now I try to create solr core.
C:\solr\bin>solr create_core -c books_data -d C:\solr Got Error :- No Conf Sub folder or Solrconfig.xml file present.
4) Then I created folder "books_data" in C:\solr location and Created conf subfolder under books_data folder and put solrconfig.xml inside conf subfolder.
5) Again start to execute query
C:\solr\bin>solr create_core -c books_data -d C:\solr\books_data Got Error :- Already core existed.
When I checked Solr Admin UI , showing error message as SolrCore Initialization Failures

   - *books_data:*
   org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
   Could not load conf for core books_data: Error loading solr config from
   C:\solr\bin\books_data\conf\solrconfig.xml


Please tell me where am I doing wrong?
Thanks.

Re: Reg:- Create Solr Core Using Command Line

Posted by "@Nandan@" <na...@gmail.com>.
Hi ,
Thanks you all for quality reply .
Finally I am able to below from Scratch:-
1) Create Core by CMD line.
2) Index CSV file by CMD

Below are my steps , and I hope other basic beginners can able to learn
easily.

Basic Information about Solr :-

Installation folder :- C:\solr

Solr bin folder location :- C:\solr\bin

*Create Solr Core [With Default Setting]:-*

1)      Go to Solr bin folder

2)      Open cmd

3)      Enter Command

C:\solr\bin>solr create_core –c films

If you will check SOLR UI , then you will able to see core name as “films”.

*Index CSV file into Existed Core [Windows 10] :-*

1)      Please check where is post.jar file.

By default , post.jar file present in solr_location/example/exampledocs
location.

2)      Open cmd in post.jar location.

Once you will open cmd , it seems like below location .

C:\solr\example\exampledocs>

3)      Please check csv file location.

In my case, CSV file located into below location.

C:\solr\example\books_data.csv

4)      Check Core name in which you want to index csv file.

In my case, Core name is “films”

5)      Use below command to Index csv file in Solr core.

Command Format:-

C:\solr\example\exampledocs>java -Dtype=text/csv -Dc=<Core_name> -jar
post.jar <CSV_FILE location>

Example:-

C:\solr\example\exampledocs>java -Dtype=text/csv -Dc=films -jar post.jar
C:\solr\example\books_data.csv


Thanks...



On Wed, Feb 7, 2018 at 1:55 PM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 2/6/2018 6:00 PM, @Nandan@ wrote:
>
>> Even I tried this one before also. And everytime getting below result.
>>
>> C:\solr\bin>post -c films example/books_data.csv
>>>
>>
>> 'post' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> C:\solr\bin>cd ..
>>
>>
>> C:\solr>bin/post -c films example/books_data.csv
>>
>> 'bin' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> I google it but not able to find exact solution.
>> Please check and Provide me solution.
>>
>
> The post tool is a shell script.  There is currently no equivalent for
> Windows.
>
> You can look at the "post" file in the bin directory to see the Java
> commandline that is used to call the post tool.  A similar java commandline
> can be called by hand on Windows.
>
> Thanks,
> Shawn
>

Re: Reg:- Create Solr Core Using Command Line

Posted by Shawn Heisey <ap...@elyograg.org>.
On 2/6/2018 6:00 PM, @Nandan@ wrote:
> Even I tried this one before also. And everytime getting below result.
> 
>> C:\solr\bin>post -c films example/books_data.csv
> 
> 'post' is not recognized as an internal or external command,
> operable program or batch file.
> 
> C:\solr\bin>cd ..
> 
> 
> C:\solr>bin/post -c films example/books_data.csv
> 
> 'bin' is not recognized as an internal or external command,
> operable program or batch file.
> 
> I google it but not able to find exact solution.
> Please check and Provide me solution.

The post tool is a shell script.  There is currently no equivalent for 
Windows.

You can look at the "post" file in the bin directory to see the Java 
commandline that is used to call the post tool.  A similar java 
commandline can be called by hand on Windows.

Thanks,
Shawn

Re: Reg:- Create Solr Core Using Command Line

Posted by "@Nandan@" <na...@gmail.com>.
Hi Abhishek,
Even I tried this one before also. And everytime getting below result.

> C:\solr\bin>post -c films example/books_data.csv

'post' is not recognized as an internal or external command,
operable program or batch file.

C:\solr\bin>cd ..


C:\solr>bin/post -c films example/books_data.csv

'bin' is not recognized as an internal or external command,
operable program or batch file.

I google it but not able to find exact solution.
Please check and Provide me solution.

Thanks

On Tue, Feb 6, 2018 at 10:15 PM, abhi Abhishek <ab...@gmail.com> wrote:

> you can try using the post Tool.
>
> https://lucene.apache.org/solr/guide/6_6/post-tool.html
>
> bin/post -c film example/books_data.csv
>
>
> Cheers!
> Abhishek
>
>
> On Tue, Feb 6, 2018 at 1:22 PM, @Nandan@ <na...@gmail.com>
> wrote:
>
> > Hi ,
> > I created core name as "films". Now I am trying to insert my csv file by
> > below step:-
> > C:\solr>curl "http://localhost:8983/solr/films/update?commit=true"
> > --data-binary @example/books_data.csv -H 'Content-type:application/csv'
> > Got Below result.
> > {
> >   "responseHeader":{
> >     "status":0,
> >     "QTime":279}}
> >
> > But in Solr Admin UI, can't able to see any data.
> > please tell me where am i wrong ?
> > Thanks
> >
> >
> > On Tue, Feb 6, 2018 at 1:42 PM, Shawn Heisey <ap...@elyograg.org>
> wrote:
> >
> > > On 2/5/2018 10:39 PM, Shawn Heisey wrote:
> > >
> > >> In order for this solr script command to work, the argument to the -d
> > >> option (which you have as C:\solr) would have to be a config
> directory,
> > >> containing a minimum of solrconfig.xml and the schema.
> > >>
> > > Replying to myself because I made an error here.
> > >
> > > The directory provided with -d needs to contain a "conf" subdirectory,
> > > which in turn must contain the files that I mentioned.
> > >
> > > Thanks,
> > > Shawn
> > >
> >
>

Re: Reg:- Create Solr Core Using Command Line

Posted by abhi Abhishek <ab...@gmail.com>.
you can try using the post Tool.

https://lucene.apache.org/solr/guide/6_6/post-tool.html

bin/post -c film example/books_data.csv


Cheers!
Abhishek


On Tue, Feb 6, 2018 at 1:22 PM, @Nandan@ <na...@gmail.com>
wrote:

> Hi ,
> I created core name as "films". Now I am trying to insert my csv file by
> below step:-
> C:\solr>curl "http://localhost:8983/solr/films/update?commit=true"
> --data-binary @example/books_data.csv -H 'Content-type:application/csv'
> Got Below result.
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":279}}
>
> But in Solr Admin UI, can't able to see any data.
> please tell me where am i wrong ?
> Thanks
>
>
> On Tue, Feb 6, 2018 at 1:42 PM, Shawn Heisey <ap...@elyograg.org> wrote:
>
> > On 2/5/2018 10:39 PM, Shawn Heisey wrote:
> >
> >> In order for this solr script command to work, the argument to the -d
> >> option (which you have as C:\solr) would have to be a config directory,
> >> containing a minimum of solrconfig.xml and the schema.
> >>
> > Replying to myself because I made an error here.
> >
> > The directory provided with -d needs to contain a "conf" subdirectory,
> > which in turn must contain the files that I mentioned.
> >
> > Thanks,
> > Shawn
> >
>

Re: Reg:- Create Solr Core Using Command Line

Posted by "@Nandan@" <na...@gmail.com>.
Hi ,
I created core name as "films". Now I am trying to insert my csv file by
below step:-
C:\solr>curl "http://localhost:8983/solr/films/update?commit=true"
--data-binary @example/books_data.csv -H 'Content-type:application/csv'
Got Below result.
{
  "responseHeader":{
    "status":0,
    "QTime":279}}

But in Solr Admin UI, can't able to see any data.
please tell me where am i wrong ?
Thanks


On Tue, Feb 6, 2018 at 1:42 PM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 2/5/2018 10:39 PM, Shawn Heisey wrote:
>
>> In order for this solr script command to work, the argument to the -d
>> option (which you have as C:\solr) would have to be a config directory,
>> containing a minimum of solrconfig.xml and the schema.
>>
> Replying to myself because I made an error here.
>
> The directory provided with -d needs to contain a "conf" subdirectory,
> which in turn must contain the files that I mentioned.
>
> Thanks,
> Shawn
>

Re: Reg:- Create Solr Core Using Command Line

Posted by Shawn Heisey <ap...@elyograg.org>.
On 2/5/2018 10:39 PM, Shawn Heisey wrote:
> In order for 
> this solr script command to work, the argument to the -d option (which 
> you have as C:\solr) would have to be a config directory, containing a 
> minimum of solrconfig.xml and the schema.
Replying to myself because I made an error here.

The directory provided with -d needs to contain a "conf" subdirectory, 
which in turn must contain the files that I mentioned.

Thanks,
Shawn

Re: Reg:- Create Solr Core Using Command Line

Posted by Shawn Heisey <ap...@elyograg.org>.
On 2/5/2018 7:45 PM, @Nandan@ wrote:
> Now I want to create solr core to start my basic search using Solr UI.
> Steps which I Follow :-
> 1) Go to bin directory and start solr
> C:\solr\bin>solr start -p 8983
> 2) books_data.csv is in C:\solr location
> 3) Now I try to create solr core.
> C:\solr\bin>solr create_core -c books_data -d C:\solr

I think that your usage of the -d option is incorrect.  In order for 
this solr script command to work, the argument to the -d option (which 
you have as C:\solr) would have to be a config directory, containing a 
minimum of solrconfig.xml and the schema.  The schema file will 
typically be named either managed-schema (with no extension) or 
schema.xml.  The exact name will depend on what solrconfig.xml contains. 
  If either of those configs reference other files, those files usually 
must also be in that directory.

Alternatively, the argument to the -d option can be the name of one of 
the configset directories in server/solr/configsets.  If -d is not 
included on the commandline, the source of the config will be 
server/solr/configsets/_default.

Once the config source is found, the create_core action will make the 
directory for the new core, make the conf directory inside that, copy 
the conf directory from your -d source, then make an HTTP call to the 
CoreAdmin API to help Solr actually find the core and load it.

Calling the CoreAdmin API yourself when you haven't provided a 
configuration won't work.  See the large warning box with the title 
"CREATE must be able to find a configuration!" at this URL:

https://lucene.apache.org/solr/guide/7_2/coreadmin-api.html

Thanks,
Shawn