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 alias <52...@qq.com> on 2017/02/06 03:31:33 UTC

回复: Migrate Documents to Another Collection

I use this command,but not effect:  http://localhost:8081/solr/admin/collections?action=MIGRATE&collection=c1&split.key=c1_&target.collection=c2,



------------------ 原始邮件 ------------------
发件人: "Erick Erickson"<er...@gmail.com>; 
发送时间: 2017年2月6日(星期一) 中午11:24
收件人: "solr-user"<so...@lucene.apache.org>; 
主题: Re: Migrate Documents to Another Collection



I do not understand the problem. The http command you've shown is
simply creating a collection. What does that have to do with migrating
from c1 to c2? In fact, it is recreating c1. Assuming you haven't
redefined the <uniqueKey>, then the router field defaults to "id". So
this is just recreating a plain-vanilla collection. If you already
have a "c1" collection, I expect the above would simply fail.

There's nothing indicating you tried to move docs from C1 to C2 as the
title of this e-mail indicates. There's no magic here, Solr
collections are completely independent of one another. If you want
docs to be moved, _you_ have to move them.

Best,
Erick



On Sun, Feb 5, 2017 at 6:20 PM, alias <52...@qq.com> wrote:
> hello,please help me look this question
>
>
>
> I have a solr collections on the merger, we would like to ask the next question is as follows I have two collections, c1 and c2,
>
> C1 colleciton there are 10 data, id is from c1_0 to c1_9,
>
> C2 colleciton also has 10 data, id is from c2_0 to c2_9,
>
> I now want to c1 id c1_ format data into the c2, I implemented the following order, it seems no effect, and why?
>
> I c1 designated in the new router.field=id
>
> http://localhost:8081/solr/admin/collections?action=CREATE&amp;name=c1&amp;numShards=3&replicationFactor=3&maxShardsPerNode=3&collection.configName=myconf&amp;router.field=id
>
> I refer to https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api12
>
> Solr version 6.3.0
>
> I have a problem? Or understanding wrong?

回复: Migrate Documents to Another Collection

Posted by alias <52...@qq.com>.
Sorry, I may not be clear enough to express, I describe the following experimental steps:
Step 1: Create two collections
Http://SOLR:8081/solr/admin/collections?action=CREATE&name=c1&numShards=3&replicationFactor=2&maxShardsPerNode=3&collection.configName=myconf
Http://SOLR:8081/solr/admin/collections?action=CREATE&name=c2&numShards=3&replicationFactor=2&maxShardsPerNode=3&collection.configName=myconf


Step 2: import test data, I only imported in c1 inside the collection, the data are as follows
"response":{"numFound":5,"start":0,"maxScore":1.0,"docs":[
      {
        "id":"aa!c10",
        "rowType":"like",
        "title":["vip a red suit0"],
        "description":["Your friend is your needs answered0"],
        "_version_":1558553792955285504},
      {
        "id":"bb!c11",
        "rowType":"like",
        "title":["vip a red suit1"],
        "description":["Your friend is your needs answered1"],
        "_version_":1558553792967868416},
      {
        "id":"aa!c12",
        "rowType":"like",
        "title":["vip a red suit2"],
        "description":["Your friend is your needs answered2"],
        "_version_":1558553792968916992},
      {
        "id":"bb!c13",
        "rowType":"like",
        "title":["vip a red suit3"],
        "description":["Your friend is your needs answered3"],
        "_version_":1558553792969965568},
      {
        "id":"aa!c14",
        "rowType":"like",
        "title":["vip a red suit4"],
        "description":["Your friend is your needs answered4"],
        "_version_":1558553792971014144}]




Step 3: to achieve the merger order, I just want to have id 'aa' at the beginning of the data mobile past
Http://SOLR:8081/solr/admin/collections?action=MIGRATE&collection=c1&split.key=aa!&target.collection=c2



In the zookeeper C1 state.json has the following parameters:
 "RoutingRules": {"aa!": {
            "RouteRanges": "37100000-3710ffff",
            "TargetCollection": "c2",
            "ExpireAt": "1486353350933"}}



After the implementation of the third step, c1 data has not moved to c2 inside, c2 data is empty, which is why, is it where I operate incorrect? 

thinks all!




------------------ 原始邮件 ------------------
发件人: "Damien Kamerman";<da...@gmail.com>;
发送时间: 2017年2月6日(星期一) 中午11:33
收件人: "solr-user"<so...@lucene.apache.org>; 

主题: Re: Migrate Documents to Another Collection



Try with split.key=!
This will migrate all docs.

On 6 February 2017 at 14:31, alias <52...@qq.com> wrote:

> I use this command,but not effect:  http://localhost:8081/solr/
> admin/collections?action=MIGRATE&collection=c1&split.
> key=c1_&target.collection=c2,
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Erick Erickson"<er...@gmail.com>;
> 发送时间: 2017年2月6日(星期一) 中午11:24
> 收件人: "solr-user"<so...@lucene.apache.org>;
> 主题: Re: Migrate Documents to Another Collection
>
>
>
> I do not understand the problem. The http command you've shown is
> simply creating a collection. What does that have to do with migrating
> from c1 to c2? In fact, it is recreating c1. Assuming you haven't
> redefined the <uniqueKey>, then the router field defaults to "id". So
> this is just recreating a plain-vanilla collection. If you already
> have a "c1" collection, I expect the above would simply fail.
>
> There's nothing indicating you tried to move docs from C1 to C2 as the
> title of this e-mail indicates. There's no magic here, Solr
> collections are completely independent of one another. If you want
> docs to be moved, _you_ have to move them.
>
> Best,
> Erick
>
>
>
> On Sun, Feb 5, 2017 at 6:20 PM, alias <52...@qq.com> wrote:
> > hello,please help me look this question
> >
> >
> >
> > I have a solr collections on the merger, we would like to ask the next
> question is as follows I have two collections, c1 and c2,
> >
> > C1 colleciton there are 10 data, id is from c1_0 to c1_9,
> >
> > C2 colleciton also has 10 data, id is from c2_0 to c2_9,
> >
> > I now want to c1 id c1_ format data into the c2, I implemented the
> following order, it seems no effect, and why?
> >
> > I c1 designated in the new router.field=id
> >
> > http://localhost:8081/solr/admin/collections?action=
> CREATE&amp;name=c1&amp;numShards=3&replicationFactor=3&maxShardsPerNode=3&
> collection.configName=myconf&amp;router.field=id
> >
> > I refer to https://cwiki.apache.org/confluence/display/solr/
> Collections+API#CollectionsAPI-api12
> >
> > Solr version 6.3.0
> >
> > I have a problem? Or understanding wrong?
>

Re: Migrate Documents to Another Collection

Posted by Damien Kamerman <da...@gmail.com>.
Try with split.key=!
This will migrate all docs.

On 6 February 2017 at 14:31, alias <52...@qq.com> wrote:

> I use this command,but not effect:  http://localhost:8081/solr/
> admin/collections?action=MIGRATE&collection=c1&split.
> key=c1_&target.collection=c2,
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Erick Erickson"<er...@gmail.com>;
> 发送时间: 2017年2月6日(星期一) 中午11:24
> 收件人: "solr-user"<so...@lucene.apache.org>;
> 主题: Re: Migrate Documents to Another Collection
>
>
>
> I do not understand the problem. The http command you've shown is
> simply creating a collection. What does that have to do with migrating
> from c1 to c2? In fact, it is recreating c1. Assuming you haven't
> redefined the <uniqueKey>, then the router field defaults to "id". So
> this is just recreating a plain-vanilla collection. If you already
> have a "c1" collection, I expect the above would simply fail.
>
> There's nothing indicating you tried to move docs from C1 to C2 as the
> title of this e-mail indicates. There's no magic here, Solr
> collections are completely independent of one another. If you want
> docs to be moved, _you_ have to move them.
>
> Best,
> Erick
>
>
>
> On Sun, Feb 5, 2017 at 6:20 PM, alias <52...@qq.com> wrote:
> > hello,please help me look this question
> >
> >
> >
> > I have a solr collections on the merger, we would like to ask the next
> question is as follows I have two collections, c1 and c2,
> >
> > C1 colleciton there are 10 data, id is from c1_0 to c1_9,
> >
> > C2 colleciton also has 10 data, id is from c2_0 to c2_9,
> >
> > I now want to c1 id c1_ format data into the c2, I implemented the
> following order, it seems no effect, and why?
> >
> > I c1 designated in the new router.field=id
> >
> > http://localhost:8081/solr/admin/collections?action=
> CREATE&amp;name=c1&amp;numShards=3&replicationFactor=3&maxShardsPerNode=3&
> collection.configName=myconf&amp;router.field=id
> >
> > I refer to https://cwiki.apache.org/confluence/display/solr/
> Collections+API#CollectionsAPI-api12
> >
> > Solr version 6.3.0
> >
> > I have a problem? Or understanding wrong?
>