Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用嵌套弹性搜索库将\u包含在\u父级中_C#_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Nest - Fatal编程技术网 elasticsearch,nest,C#,elasticsearch,Nest" /> elasticsearch,nest,C#,elasticsearch,Nest" />

C# 使用嵌套弹性搜索库将\u包含在\u父级中

C# 使用嵌套弹性搜索库将\u包含在\u父级中,c#,elasticsearch,nest,C#,elasticsearch,Nest,NEST C#中的IncludeInParent弹性属性是否与IncludeAll中的一样可用 如果是,则说明如何将IncludeInParent属性添加到对象。 我不想使用fluent映射,因为我的索引创建类是动态的,例如: public ESClient CreateIndex<T>() where T : class { if (!Client.IndexExists(f => f.Index(ESIndexName)).Exis

NEST C#中的IncludeInParent弹性属性是否与IncludeAll中的一样可用

如果是,则说明如何将IncludeInParent属性添加到对象。 我不想使用fluent映射,因为我的索引创建类是动态的,例如:

 public ESClient CreateIndex<T>() where T : class
        {
            if (!Client.IndexExists(f => f.Index(ESIndexName)).Exists)
            {
                Client.CreateIndex(ESIndexName, c => c
                    .NumberOfReplicas(1)
                    .NumberOfShards(4)
                    .Settings(s => s
                        .Add("merge.policy.merge_factor", "10")
                        .Add("search.slowlog.threshold.fetch.warn", "1s")
                    )
                    .AddMapping<T>(m => m.MapFromAttributes())
               );

            }
            return this;
        }
public ESClient CreateIndex(),其中T:class
{
如果(!Client.indexists(f=>f.Index(ESIndexName)).Exists)
{
CreateIndex(ESIndexName,c=>c
.副本数量(1)
.NumberOfShard(4)
.Settings(s=>s
.Add(“merge.policy.merge\u factor”,“10”)
.Add(“search.slowlog.threshold.fetch.warn”,“1s”)
)
.AddMapping(m=>m.MapFromAttributes())
);
}
归还这个;
}
是否有一种方法可以指定IncludeInParent,如includeAll,如下所示:

[ElasticProperty(IncludeInAll = true)]
public List<Cars> Cars { get; set; }
[弹性属性(includenall=true)]
公共列表车辆{get;set;}

如果没有,我认为在NEST库中添加IncludeInParent elastic属性很好。

您所要求的只能使用fluent api完成


这篇文章中的回复可能会对您有所帮助。

我实际上在Nest项目中添加了IncludeInParent Elastic属性,它工作起来很有魅力。