Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.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#Nest:如何索引geo poinst数组_C#_Arrays_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Nest - Fatal编程技术网 elasticsearch,nest,C#,Arrays,elasticsearch,Nest" /> elasticsearch,nest,C#,Arrays,elasticsearch,Nest" />

C#Nest:如何索引geo poinst数组

C#Nest:如何索引geo poinst数组,c#,arrays,elasticsearch,nest,C#,Arrays,elasticsearch,Nest,你好,我是新来的弹性和巢。 我使用了一个如何索引地理点位置的示例,该示例运行良好,因为我可以在kibana地图中看到地理点 这是我的数据结构: public class LocationArray { public string ArrayNameArtical { get; set; } [ElasticProperty(Type = FieldType.GeoPoint)] public IEnumerable<Location> Locations {

你好,我是新来的弹性和巢。 我使用了一个如何索引地理点位置的示例,该示例运行良好,因为我可以在kibana地图中看到地理点

这是我的数据结构:

public class LocationArray
{
    public string ArrayNameArtical { get; set; }
    [ElasticProperty(Type = FieldType.GeoPoint)]
    public IEnumerable<Location> Locations { get; set; }
}
public class Location
{
    public string Name { get; set; }

    [ElasticProperty(Type = FieldType.GeoPoint)]
    public Coordinate Coordinate { get; set; }
}


public class Coordinate
{
    public double Lat { get; set; }
    public double Lon { get; set; }
}
公共类位置数组
{
公共字符串ArrayNameArtical{get;set;}
[ElasticProperty(类型=FieldType.GeoPoint)]
公共IEnumerable位置{get;set;}
}
公共类位置
{
公共字符串名称{get;set;}
[ElasticProperty(类型=FieldType.GeoPoint)]
公共坐标{get;set;}
}
公共类坐标
{
公共双Lat{get;set;}
公共双Lon{get;set;}
}
我的代码索引如下:

var response = client.CreateIndex(indexName, s => s
      .AddMapping<Location>(f => f
        .MapFromAttributes() 
        .Properties(p => p
          .GeoPoint(g => g.Name(n => n.Coordinate).IndexGeoHash().IndexLatLon())
        )
      )
    );
    client.IndexMany(new[]{
        new Location
        {
            Name = "Amsterdam",
            Coordinate = new Coordinate { Lat =  52.3740300, Lon = 4.8896900}
        },
        new Location
        {
            Name = "Rotterdam",
            Coordinate = new Coordinate { Lat = 51.9225000, Lon = 4.4791700}
        },
        new Location
        {
            Name = "Utrecht",
            Coordinate = new Coordinate { Lat =  52.0908300,  Lon = 5.1222200}
        },new Location
        {
            Name = "Den Haag",
            Coordinate = new Coordinate { Lat =  52.3740300, Lon = 4.8896900}
        }
    });
var response=client.CreateIndex(indexName,s=>s
.AddMapping(f=>f
.MapFromAttributes()
.Properties(p=>p
.GeoPoint(g=>g.Name(n=>n.Coordinate).IndexGeoHash().indexlaton())
)
)
);
client.IndexMany(新[]{
新位置
{
Name=“阿姆斯特丹”,
坐标=新坐标{Lat=52.3740300,Lon=4.8896900}
},
新位置
{
Name=“鹿特丹”,
坐标=新坐标{Lat=51.9225000,Lon=4.4791700}
},
新位置
{
Name=“乌得勒支”,
坐标=新坐标{Lat=52.0908300,Lon=5.1222200}
},新地点
{
Name=“Den Haag”,
坐标=新坐标{Lat=52.3740300,Lon=4.8896900}
}
});
现在我想索引LocationArray类,它似乎需要更改我的映射,但我不知道如何做。无论如何,我可以在kibana中看到数组数据,但无法通过映射查看它。
地理点的索引数组有什么问题吗?

好的,所以经过几个小时的挖掘,找到了映射此地理点数组的方法。。 希望有一天它能帮助别人:)

client.Map(m=>m
.MapFromAttributes().Properties(p=>p
.NestedObject(否=>否
.Name(pl=>pl.Locations.First())
.Dynamic()
.Enabled()
.includenall()
.IncludeInParent()
.IncludeInRoot()
.MapFromAttributes()
.Path(“完整”)
.Properties(pprops=>pprops
.地质点(ps=>ps
.Name(pg=>pg.Coordinate)
.IndexGeoHash().IndexLatLon()
)
)
))
);

好的,经过几个小时的挖掘,我们找到了绘制这个地理点阵列的方法。。 希望有一天它能帮助别人:)

client.Map(m=>m
.MapFromAttributes().Properties(p=>p
.NestedObject(否=>否
.Name(pl=>pl.Locations.First())
.Dynamic()
.Enabled()
.includenall()
.IncludeInParent()
.IncludeInRoot()
.MapFromAttributes()
.Path(“完整”)
.Properties(pprops=>pprops
.地质点(ps=>ps
.Name(pg=>pg.Coordinate)
.IndexGeoHash().IndexLatLon()
)
)
))
);

谢谢!它帮助了我:)谢谢你!它帮助了我:)
client.Map<LocationArray>(m => m
                        .MapFromAttributes().Properties(p=>p
                            .NestedObject<Location>(no => no
                            .Name(pl => pl.Locations.First())
                            .Dynamic()
                            .Enabled()
                            .IncludeInAll()
                            .IncludeInParent()
                            .IncludeInRoot()
                            .MapFromAttributes()
                            .Path("full")
                            .Properties(pprops => pprops
                                .GeoPoint(ps => ps
                                    .Name(pg => pg.Coordinate)
                                    .IndexGeoHash().IndexLatLon()
                                )
                            )
                        ))
                    );