我远不是具有任何 .net 经验的开发人员,但工作中的开发团队希望使用 Serilog 和 serilog-sinks-elasticsearch 将日志推送到我的 ELK 堆栈中。
查看 serilog-sinks-elasticsearch 的配置,似乎没有任何方法可以发送写入 ElasticSearch 集群所需的凭据。
这只是一个愚蠢的操作人员问题还是我只是错过了某个地方的配置?
谢谢
我有一个Solr索引,可以在每个产品的多值字段中存储Price.
我需要按价格对结果集进行排序,其中价格从低到高,从高到低.
我尝试使用Price它显示错误排序您无法对多值=真实字段进行排序.
下面是我的solr XML
<arr name="sellprice">
<float>195.0</float>
<float>136.5</float>
<float>10.0</float>
</arr>
Run Code Online (Sandbox Code Playgroud)
在schema.xml中
<field name="sellprice" type="float" indexed="true" stored="true" multiValued="true"/>
Run Code Online (Sandbox Code Playgroud)
在C#代码中
ISolrQueryResults<ProductTest2> powerArticles = solr.Query(new
SolrQuery("WebCategory_Id:10") && new SolrQueryInList("FilterID",
146), new QueryOptions { FilterQueries = new[] { new
SolrQueryByRange<decimal>("sellprice", 10, 40) }, OrderBy = new[] {
new SolrNet.SortOrder(sellprice, desc) } });
Run Code Online (Sandbox Code Playgroud)
有人可以用一些好的例子解释一下吗?
我正在尝试为对象创建动态映射,如下所示:
{
"product": {
"productId": 99999,
"manufacturerId": "A0001",
"manufacturerCode": "A101LI",
"name": "Test Product",
"description": "Describe the product here.",
"feature_details":{
"category": "Category1",
"brand": "Brand Name"
},
"feature_tpcerts":{
"certifiedPass": true,
"levelCertified": 2
},
"feature_characteristics":{
"amount": 0.73,
"location": 49464
}
}
}
Run Code Online (Sandbox Code Playgroud)
我希望这些feature_*
属性是一个嵌套类型,我在下面的映射中使用nested_feature模板定义了它,它按预期工作.然而,我也希望有在的嵌套对象的每个属性feature_*
的属性为multi_value
与另外的facet
定义的属性.我已经尝试了第二个nested_template模板,但没有任何成功.
{
"product" : {
"_timestamp" : {"enabled" : true, "store": "yes" },
"dynamic_templates": [
{
"nested_feature": {
"match" : "feature_*",
"mapping" : {
"type" : "nested",
"stored": "true"
}
}
},
{ …
Run Code Online (Sandbox Code Playgroud) 基本上我正在尝试索引Solr中的word或pdf文档并找到ExtractingRequestHandler,但是无法弄清楚如何在执行HTTP POST请求的c#中编写代码,就像在Solr wiki中一样:http://wiki.apache. org/solr/ExtractingRequestHandler.
我已经使用Solr zip中example/solr目录中的文件在Tomcat 7(7.0.22)上安装了Solr 3.4,我没有改变任何东西.ExtractingRequestHandler应该在solrconfig.xml中开箱即用,可以使用了,对吗?
你们有些人可以提供一个C#(HttpWebRequest)示例,说明如何制作HTTP POST请求并上传PDF文件,就像在Solr wiki中使用curl一样吗?
我看遍了这个网站和许多其他人试图找到一个例子或教程如何完成,但没有找到任何东西.
编辑:
我终于设法使用SolrNet让它工作了!
为了使它能够工作,您需要将它从Solr zip复制到Solr安装目录中的lib文件夹:
使用SolrNet 0.4.0 beta 2,此代码可以完成以下任务:
Startup.Init<IndexDocument>("YOUR-SOLR-SERVICE-PATH");
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<IndexDocument>>();
using (FileStream fileStream = File.OpenRead("FILE-PATH-FOR-THE-FILE-TO-BE-INDEXED"))
{
var response =
solr.Extract(
new ExtractParameters(fileStream, "doc1")
{
ExtractFormat = ExtractFormat.Text,
ExtractOnly = false
});
}
solr.Commit();
Run Code Online (Sandbox Code Playgroud)
抱歉,添麻烦了.但我希望其他人会觉得这很有用.
我们正在考虑从Solr/Solr.net切换到Elasticsearch.我们从NEST开始.我们在搜索索引中只有4个文档.
private static void Main(string[] args)
{
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(
node, "my-application");
var client = new ElasticClient(settings);
var stopwatch = Stopwatch.StartNew();
var sr = client.Get<Movie>(1);
Console.WriteLine(stopwatch.ElapsedMilliseconds);
}
Run Code Online (Sandbox Code Playgroud)
上面的代码大约需要.250ms,而相同的代码HttpClient
和JsonSerializer
30-45ms.只有4个文件,250毫秒是太多的时间.
NEST可以在高流量新闻网站上使用,还是推荐HttpClient
+ JsonSerializer
combo?搜索页面是2013年我们网站上访问量最大的页面.
提前致谢.
我刚刚在两台独立的Windows 8计算机上将Web Platform Installer升级到4.5版.(一个是物理机器,另一个是VM).我无法运行WPI 4.5,两者都显示以下相同的错误:
解析EntityName时发生错误.第42134行,第81位.
更新: 确认Microsoft的产品列表出错.找到此日志文件条目:
DownloadManager Information: 0 : Loading product xml from: https://go.microsoft.com/?linkid=9817844
DownloadManager Information: 0 : https://go.microsoft.com/?linkid=9817844 responded with 302
DownloadManager Information: 0 : Response headers:
HTTP/1.1 302 Found
Cache-Control: private
Content-Length: 175
Content-Type: text/html; charset=utf-8
Expires: Tue, 19 Feb 2013 18:23:59 GMT
Location: https://www.microsoft.com/web/webpi/4.5/webproductlist.xml
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Tue, 19 Feb 2013 18:24:59 GMT
DownloadManager Error: 0 : Error loading downloaded product file: 'System.Xml.XmlException: An error occurred while parsing EntityName. Line …
Run Code Online (Sandbox Code Playgroud) Solr doc解释了expand = true在SynonymFilterFactory中的作用如下:
a synonym will be expanded to all equivalent synonyms.
If it is false, all equivalent synonyms will be reduced to the first in the list.
Run Code Online (Sandbox Code Playgroud)
我想知道它究竟意味着什么?如果有人可以详细说明它的作用,那就太好了.
我正在使用 NEST(c#) 与 Elasticsearch 进行通信。然而,结果不是基于命中分数,我如何根据命中分数对结果进行排序,而且我只得到 10 条记录。下面是我的代码示例
var result = client.Search(q => q
.Index(IndexName)
.From(0)
.Type("post")
.Fields("title","message")
.Size(10)
.Query(fq1 => fq1
.QueryString(fqqs1 => fqqs1
.OnFieldsWithBoost(d => d
.Add("title", 7.0)
.Add("message", 5.0))
.Query(SearchQuery))));
Run Code Online (Sandbox Code Playgroud)
我的message
字段将包含大文本,是否可以像谷歌搜索结果一样从消息中仅获取搜索关键字周围的几行
我通过 ElasticSearch Sense 浏览器插件创建了以下索引,并创建了 C# Nest Fluent Mapping。我可以在 Nest 中表达除 nGrams 过滤器上的“token_chars”之外的所有内容。我没有在 C# nest 上获得强类型属性来添加“token_chars”。有没有人遇到过同样的问题?
下面列出了 json 和 c# 设置。请帮忙
"analysis": {
"analyzer": {
"str_index_analyzer": {
"filter": [
"lowercase",
"substring"
],
"tokenizer": "keyword"
},
"filter": {
"substring": {
"max_gram": "50",
"type": "nGram",
"min_gram": "2",
"token_chars": [ /*Not able to map */
"letter",
"digit"
]
}
}
Run Code Online (Sandbox Code Playgroud)
我没有在 C# nest 上获得强类型属性来添加“token_chars”。有人面临同样的问题吗?
"analysis": {
"analyzer": {
"str_index_analyzer": {
"filter": [
"lowercase",
"substring"
],
"tokenizer": "keyword"
},
"filter": {
"substring": {
"max_gram": "50", …
Run Code Online (Sandbox Code Playgroud)