我添加了新的映射(主要是现有字段的not_analyzed版本)我现在必须弄清楚如何重新索引现有数据.我试过按照弹性搜索网站上的指南,但这太混乱了.我也尝试过使用插件(elasticsearch-reindex,allegro/elasticsearch-reindex-tool).我查看了ElasticSearch - 以零停机时间重新索引数据,这是一个类似的问题.我希望不必依赖外部工具(如果可能)并尝试使用批量API(与原始插入一样)
我可以很容易地重建整个索引,因为它确实是一个只读数据,但是如果我想要在生产中使用它时我想要添加更多字段等,那么从长远来看它不会真正起作用.我想知道是否有人知道一个易于理解/遵循的解决方案或相对新手ES的步骤.我在版本2并使用Windows.
我正在考虑将一个完整的复杂对象添加到表中.来自良好的老式SQL方法,我显然将其分为表格,但我正在尝试不同的方法.所以基本上我有一个对象,它由一个嵌套类(在你反序列化json集合时得到的东西)组成,它有通常的Customer,Business和InvoiceItems列表.
public class Business
{
public string _id { get; set; }
public string name { get; set; }
public string street_1 { get; set; }
public string street_2 { get; set; }
public string town { get; set; }
public string county { get; set; }
public string postcode { get; set; }
//other fields as needed
}
public class Customer
{
public string _id { get; set; }
public string name { get; set; }
public string street_1 …
Run Code Online (Sandbox Code Playgroud) 我使用 MongoDB 的 Compass 创建了一个导出到 C# 的管道,但是我不确定如何在实际代码中使用它(工具生成 BsonArray)来执行聚合?这是 LINQ 目前不支持的 geoNear(如果有任何方位的话)。
我尝试使用一些文档var result = collection.Aggregate(pipeline);
建议的(管道 - 是 Compass 生成的 BsonArray 对象)。
指南针将创建的示例:
new BsonArray
{
new BsonDocument("$geoNear",
new BsonDocument
{
{ "near",
new BsonDocument
{
{ "type", "Point" },
{ "coordinates",
new BsonArray
{
-2.11,
52.55
} }
} },
{ "distanceField", "distanceField" },
{ "maxDistance", 5000 },
{ "spherical", true }
}),
new BsonDocument("$sort",
new BsonDocument("distanceField", -1))
};
Run Code Online (Sandbox Code Playgroud) 我的服务器上有多个 IP,并且想在使用 HttpClient 类从 API 获取/发布数据时选择使用其中一个。(或者甚至同时发送请求,但使用 2 个 IP,而不仅仅是一个)
我已经看到一些使用 HttpWebRequest (此处)的示例,这些示例利用委托,但我想继续使用 HttpClient 实现。