ElasticSearch — отношения родитель-потомок

Я пытаюсь создать родительские дочерние отношения с помощью клиента NEST для С#. Вот код, который у меня есть. Я использую elasticsearch 1.1.1, и этот код, похоже, добавляет объект testp1 в индекс testparent, но не добавляет никаких объектов в индекс testchild. Если я не передаю родителя, используя параметры индекса, он работает нормально. Любая помощь в этом приветствуется.

private static void LoadTestData()
{
    var esClient = CreateNESTConnection();
    esClient.MapFluent<testparent>(x => x
        .IndexName("testdb")
        .TypeName("testparent")
        .IdField(y => y.SetPath("Id"))
        .Properties(cprops => cprops
            .String(a => a.Name("id"))
            .Number(a => a.Name("parentid").Type(NumberType.@long))
            .Number(a => a.Name("prop1").Type(NumberType.@long))
            .Number(a => a.Name("prop2").Type(NumberType.@long))
            .Boolean(a => a.Name("checkflag"))
    ));

    esClient.MapFluent<testchild>(x => x
        .IndexName("testdb")
        .TypeName("testchild")
        .SetParent("testparent")
        .Properties(cprops => cprops
            .Number(a => a.Name("dockey").Type(NumberType.@long))
            .Number(a => a.Name("docvalue").Type(NumberType.@float))
    ));

    testparent testp1 = new testparent();
    testp1.checkflag = true;
    testp1.id = "7";
    testp1.parentid = 77;
    testp1.prop1 = 1;
    testp1.prop2 = 2;
    testchild testc1 = new testchild();
    testc1.dockey = 100;
    testc1.docvalue = 111;

    testchild testc2 = new testchild();
    testc2.dockey = 100;
    testc2.docvalue = 111;

    esClient.Index(testp1, "testdb");
    IndexParameters parameters = new IndexParameters();
    parameters.Parent = "7";
    var t = esClient.Index(testc1, "testdb", parameters);
    Console.WriteLine(t.OK);
    t = esClient.Index(testc2, "testdb", parameters);
    Console.WriteLine(t.OK);
}

person user3614262    schedule 07.05.2014    source источник
comment
вы получаете какое-либо решение?   -  person NMathur    schedule 24.08.2017