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 Hakim Benoudjit <h....@gmail.com> on 2014/01/28 23:00:33 UTC

Use a field without predefining it it the schema

Hi guys

With the new version of solr (4.6), can I add a field to the index, knowing
that this field doesnt appear(isnt predefined) in the schema?

I ask this question because I ve seen an issue (on jira) related to this.

Thanks!

Re: Use a field without predefining it it the schema

Posted by Steve Rowe <sa...@gmail.com>.
Hi Hakim,

You don’t have to restart the Solr app to make use of fields added through the Schema REST API.

This feature was first available in Solr v4.4 and remains available in Solr v4.6.

Steve
 
On Jan 29, 2014, at 7:11 PM, Hakim Benoudjit <h....@gmail.com> wrote:

> Thanks Steve for the link.
> It seems very easy to create `new fields` in the `schema` using the `POST
> request`. But doest mean that I dont have to restart the `solr app`? Is so,
> is this feature available in latest solr version (`v4.6`)?
> 
> 
> 2014-01-29 Alexandre Rafalovitch <ar...@gmail.com>
> 
>> There is an example in the distribution that shows how new fields are
>> auto-defined. I think it is example-schemaless. The secret is in the
>> UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
>> - I guess - automatically generated schema.
>> 
>> Just remember that once the field is added the first time, it now
>> exists. So careful not to send a date-looking thing into what should
>> be a text field.
>> 
>> Regards,
>>   Alex.
>> Personal website: http://www.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all
>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
>> book)
>> 
>> 
>> On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
>>> Hi Hakim,
>>> 
>>> Check out the section of the Solr Reference Guide on modifying the
>> schema via REST API:
>>> 
>>> 
>> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
>>> 
>>> Steve
>>> 
>>> On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com>
>> wrote:
>>> 
>>>> Hi guys
>>>> 
>>>> With the new version of solr (4.6), can I add a field to the index,
>> knowing
>>>> that this field doesnt appear(isnt predefined) in the schema?
>>>> 
>>>> I ask this question because I ve seen an issue (on jira) related to
>> this.
>>>> 
>>>> Thanks!
>>> 
>> 


Re: Use a field without predefining it it the schema

Posted by Hakim Benoudjit <h....@gmail.com>.
Thanks, That's a good feature since I dont have to reindex the whole data,
nor to restart solr app.


2014-01-30 Steve Rowe <sa...@gmail.com>

> Hakim,
>
> All the fields you have added manually to the schema will be kept when you
> switch to using managed schema.
>
> From the managed schema page on the Solr Reference Guide you linked to
> (describing what happens after you add <schemaFactory
> class="ManagedIndexSchemaFactory">...</schemaFactory> to your solrconfig.xml,
> and then restart Solr in order for the change to take effect):
>
>     Once Solr is restarted, the existing schema.xml file is renamed to
>     schema.xml.bak and the contents are written to a file with the name
>     defined as the managedSchemaResourceName.
>
> Steve
>
> On Jan 29, 2014, at 7:15 PM, Hakim Benoudjit <h....@gmail.com>
> wrote:
>
> > I have found this link
> >
> https://cwiki.apache.org/confluence/display/solr/Managed+Schema+Definition+in+SolrConfig
> > .
> > I dont know if it's required to modify the schema (see the link), to make
> > it editable by the REST API. I wish that it doesnt clear all the fields
> > that I have added manually to the schema.
> >
> >
> > 2014-01-30 Hakim Benoudjit <h....@gmail.com>
> >
> >> Thanks Steve for the link.
> >> It seems very easy to create `new fields` in the `schema` using the
> `POST
> >> request`. But doest mean that I dont have to restart the `solr app`? Is
> so,
> >> is this feature available in latest solr version (`v4.6`)?
> >>
> >>
> >> 2014-01-29 Alexandre Rafalovitch <ar...@gmail.com>
> >>
> >> There is an example in the distribution that shows how new fields are
> >>> auto-defined. I think it is example-schemaless. The secret is in the
> >>> UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
> >>> - I guess - automatically generated schema.
> >>>
> >>> Just remember that once the field is added the first time, it now
> >>> exists. So careful not to send a date-looking thing into what should
> >>> be a text field.
> >>>
> >>> Regards,
> >>>   Alex.
> >>> Personal website: http://www.outerthoughts.com/
> >>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> >>> - Time is the quality of nature that keeps events from happening all
> >>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
> >>> book)
> >>>
> >>>
> >>> On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
> >>>> Hi Hakim,
> >>>>
> >>>> Check out the section of the Solr Reference Guide on modifying the
> >>> schema via REST API:
> >>>>
> >>>>
> >>>
> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
> >>>>
> >>>> Steve
> >>>>
> >>>> On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com>
> >>> wrote:
> >>>>
> >>>>> Hi guys
> >>>>>
> >>>>> With the new version of solr (4.6), can I add a field to the index,
> >>> knowing
> >>>>> that this field doesnt appear(isnt predefined) in the schema?
> >>>>>
> >>>>> I ask this question because I ve seen an issue (on jira) related to
> >>> this.
> >>>>>
> >>>>> Thanks!
> >>>>
> >>>
> >>
> >>
>
>

Re: Use a field without predefining it it the schema

Posted by Steve Rowe <sa...@gmail.com>.
Hakim,

All the fields you have added manually to the schema will be kept when you switch to using managed schema.

From the managed schema page on the Solr Reference Guide you linked to (describing what happens after you add <schemaFactory class="ManagedIndexSchemaFactory”>…</schemaFactory> to your solrconfig.xml, and then restart Solr in order for the change to take effect):

    Once Solr is restarted, the existing schema.xml file is renamed to
    schema.xml.bak and the contents are written to a file with the name
    defined as the managedSchemaResourceName.

Steve

On Jan 29, 2014, at 7:15 PM, Hakim Benoudjit <h....@gmail.com> wrote:

> I have found this link
> https://cwiki.apache.org/confluence/display/solr/Managed+Schema+Definition+in+SolrConfig
> .
> I dont know if it's required to modify the schema (see the link), to make
> it editable by the REST API. I wish that it doesnt clear all the fields
> that I have added manually to the schema.
> 
> 
> 2014-01-30 Hakim Benoudjit <h....@gmail.com>
> 
>> Thanks Steve for the link.
>> It seems very easy to create `new fields` in the `schema` using the `POST
>> request`. But doest mean that I dont have to restart the `solr app`? Is so,
>> is this feature available in latest solr version (`v4.6`)?
>> 
>> 
>> 2014-01-29 Alexandre Rafalovitch <ar...@gmail.com>
>> 
>> There is an example in the distribution that shows how new fields are
>>> auto-defined. I think it is example-schemaless. The secret is in the
>>> UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
>>> - I guess - automatically generated schema.
>>> 
>>> Just remember that once the field is added the first time, it now
>>> exists. So careful not to send a date-looking thing into what should
>>> be a text field.
>>> 
>>> Regards,
>>>   Alex.
>>> Personal website: http://www.outerthoughts.com/
>>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>>> - Time is the quality of nature that keeps events from happening all
>>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
>>> book)
>>> 
>>> 
>>> On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
>>>> Hi Hakim,
>>>> 
>>>> Check out the section of the Solr Reference Guide on modifying the
>>> schema via REST API:
>>>> 
>>>> 
>>> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
>>>> 
>>>> Steve
>>>> 
>>>> On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com>
>>> wrote:
>>>> 
>>>>> Hi guys
>>>>> 
>>>>> With the new version of solr (4.6), can I add a field to the index,
>>> knowing
>>>>> that this field doesnt appear(isnt predefined) in the schema?
>>>>> 
>>>>> I ask this question because I ve seen an issue (on jira) related to
>>> this.
>>>>> 
>>>>> Thanks!
>>>> 
>>> 
>> 
>> 


Re: Use a field without predefining it it the schema

Posted by Hakim Benoudjit <h....@gmail.com>.
I have found this link
https://cwiki.apache.org/confluence/display/solr/Managed+Schema+Definition+in+SolrConfig
.
I dont know if it's required to modify the schema (see the link), to make
it editable by the REST API. I wish that it doesnt clear all the fields
that I have added manually to the schema.


2014-01-30 Hakim Benoudjit <h....@gmail.com>

> Thanks Steve for the link.
> It seems very easy to create `new fields` in the `schema` using the `POST
> request`. But doest mean that I dont have to restart the `solr app`? Is so,
> is this feature available in latest solr version (`v4.6`)?
>
>
> 2014-01-29 Alexandre Rafalovitch <ar...@gmail.com>
>
> There is an example in the distribution that shows how new fields are
>> auto-defined. I think it is example-schemaless. The secret is in the
>> UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
>> - I guess - automatically generated schema.
>>
>> Just remember that once the field is added the first time, it now
>> exists. So careful not to send a date-looking thing into what should
>> be a text field.
>>
>> Regards,
>>    Alex.
>> Personal website: http://www.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all
>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
>> book)
>>
>>
>> On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
>> > Hi Hakim,
>> >
>> > Check out the section of the Solr Reference Guide on modifying the
>> schema via REST API:
>> >
>> >
>> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
>> >
>> > Steve
>> >
>> > On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com>
>> wrote:
>> >
>> >> Hi guys
>> >>
>> >> With the new version of solr (4.6), can I add a field to the index,
>> knowing
>> >> that this field doesnt appear(isnt predefined) in the schema?
>> >>
>> >> I ask this question because I ve seen an issue (on jira) related to
>> this.
>> >>
>> >> Thanks!
>> >
>>
>
>

Re: Use a field without predefining it it the schema

Posted by Hakim Benoudjit <h....@gmail.com>.
Thanks Steve for the link.
It seems very easy to create `new fields` in the `schema` using the `POST
request`. But doest mean that I dont have to restart the `solr app`? Is so,
is this feature available in latest solr version (`v4.6`)?


2014-01-29 Alexandre Rafalovitch <ar...@gmail.com>

> There is an example in the distribution that shows how new fields are
> auto-defined. I think it is example-schemaless. The secret is in the
> UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
> - I guess - automatically generated schema.
>
> Just remember that once the field is added the first time, it now
> exists. So careful not to send a date-looking thing into what should
> be a text field.
>
> Regards,
>    Alex.
> Personal website: http://www.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all
> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
> book)
>
>
> On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
> > Hi Hakim,
> >
> > Check out the section of the Solr Reference Guide on modifying the
> schema via REST API:
> >
> >
> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
> >
> > Steve
> >
> > On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com>
> wrote:
> >
> >> Hi guys
> >>
> >> With the new version of solr (4.6), can I add a field to the index,
> knowing
> >> that this field doesnt appear(isnt predefined) in the schema?
> >>
> >> I ask this question because I ve seen an issue (on jira) related to
> this.
> >>
> >> Thanks!
> >
>

Re: Use a field without predefining it it the schema

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
There is an example in the distribution that shows how new fields are
auto-defined. I think it is example-schemaless. The secret is in the
UpdateRequestProcessor chain that does cleanup and auto-mapping. Plus
- I guess - automatically generated schema.

Just remember that once the field is added the first time, it now
exists. So careful not to send a date-looking thing into what should
be a text field.

Regards,
   Alex.
Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Wed, Jan 29, 2014 at 5:45 AM, Steve Rowe <sa...@gmail.com> wrote:
> Hi Hakim,
>
> Check out the section of the Solr Reference Guide on modifying the schema via REST API:
>
> https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema
>
> Steve
>
> On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com> wrote:
>
>> Hi guys
>>
>> With the new version of solr (4.6), can I add a field to the index, knowing
>> that this field doesnt appear(isnt predefined) in the schema?
>>
>> I ask this question because I ve seen an issue (on jira) related to this.
>>
>> Thanks!
>

Re: Use a field without predefining it it the schema

Posted by Steve Rowe <sa...@gmail.com>.
Hi Hakim,

Check out the section of the Solr Reference Guide on modifying the schema via REST API:

https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-Modifytheschema

Steve

On Jan 28, 2014, at 5:00 PM, Hakim Benoudjit <h....@gmail.com> wrote:

> Hi guys
> 
> With the new version of solr (4.6), can I add a field to the index, knowing
> that this field doesnt appear(isnt predefined) in the schema?
> 
> I ask this question because I ve seen an issue (on jira) related to this.
> 
> Thanks!