问题标签 [elasticsearch.net]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2532 浏览

nest - Elasticsearch.NET 版本 7 - 如何检查索引是否存在

在 Elasticsearch.NET 6.x 中,可以使用IElasticClient以下方法检查索引是否存在:

在 Elasticsearch.NET 版本 7 中删除了方法。

0 投票
1 回答
8804 浏览

c# - Elasticsearch.NET 版本 7 - 如何创建索引

在 Elasticsearch.NET 6.x 中,可以使用以下方法创建索引IElasticClient

在 Elasticsearch.NET 版本 7 中删除了方法。

0 投票
1 回答
812 浏览

elasticsearch - 无法加载文件或程序集“netstandard”或其依赖项之一

我将我的解决方案 ElasticSearch.net 和嵌套库升级到 7.1.0 版本。部署代码后,我收到以下错误:

我尝试将库复制到我部署的服务器,但这不起作用。

升级细节:1.)ElasticSearch.net 5.6.1 到 7.1.0

2.)嵌套 5.6.1 到 7.1.0

3.) .NetFramework 4.7.3 已安装

4.) VS2017

从 nuget 包管理器升级。

0 投票
1 回答
410 浏览

elasticsearch - How can I execute ElasticSearch query on multiple indices with nested mapping

I have two indices with the following configuration with mappings

1) Properties mapping

and

2) Owner

with the following POCO definitions

Trying to do a search through the two indices like so

calling the SearchPropertiesAsync method returns this error messages (truncated for brevity)

Notice that it looks like its trying to perform a nested search of owner. on property index and a nested search of property. on owner index which doesnt exist.

I feel like this should be a very trivial problem but I have been using ElasticSearch for only 4days now and still very new into it.

Is there something I am doing wrongly or is there something I am missing. Have searched the whole internet to even arrive at the solution I have at the moment.

Note that when you executed the nested query only one index at a time, the code works fine but trying to execute on multiple Indices is where my problem lies. Any help will be highly appreciated.

I am using ElasticSearch 7.3.2 and Nest Client 7.3.0.

I don't mind downgrading to a lower version that works.

0 投票
1 回答
402 浏览

c# - MultiMatch ElasticSearch 查询,过滤器具有 Must、Must_Not 和 Should 条件

我正在开发一个 POC,以使用 ElasticSearch.Net 和 Nest 客户端在 C# 中包含 ElasticSearch(v7.3) 搜索。我正在尝试将 Json 查询构建到 Nest Query DSL 中以获取一些数据。

这是 Json 查询:

这是一个非常复杂的查询,但这对于我正在处理的项目来说是正常的。

我试图转换查询:

我面临的问题是将 JSON 查询的过滤器对象转换为查询 DSL。每个 Must、Must_Not 和 Should 条件中有多个Term查询,当我尝试在查询中添加时会出现错误QueryContainer doesn't contain a definition for 'Term' and no....。我究竟做错了什么?

在此先感谢您的帮助!!

0 投票
1 回答
727 浏览

nest - 如何在 NEST v7.x 中获取索引设置

在以前版本的 NEST/Elasticsearch.Net (v5.x) 中,我们可以使用以下代码来获取索引设置。

但是,这些方法似乎已在 v7.X 中被删除。V7.x 中的等价物是什么?

至少在 Java 方面,有一个带有一些适当文档的 Get Settings API。我在 NEST 上没有看到类似的内容。

https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-get-settings.html

如果有人知道等效的 api 和/或任何可用的文档,请告诉我。

谢谢!

0 投票
1 回答
808 浏览

c# - 如何使用elasticsearch.net批量API通过btye数组将json文件导入elasticsearch?

我有一些 json 文件需要导入到 elasticsearch。

我使用 curl api。以下是示例,对我来说效果很好。


我使用HttpWebRequest进行模拟,它对我来说也很好。

但我找不到带有 elasticsearch.net 的导入 json 文件的批量 api。

是否有一些等于HttpWebRequest的函数可以将 json 文件发布到 elasticsearch ?

elasticsearch.net 库 ElasticLowLevelClient 或 ElasticClient 是否支持使用 btye 数组导入 json 文件?

0 投票
1 回答
585 浏览

c# - 如何使用 Elasticsearch Nest 在 C# 中动态映射 JObject 的属性

我想使用 Nest 在 C# 中动态映射 JObject 中的属性。目标是将对象的每个字符串字段映射为 SearchAsYouType。我想到了 3 种没有用的方法:

  1. 使用 AutoMap 并直接在 C# 类中声明属性

2.使用DynamicTemplates但我在映射中找不到SearchAsYouType,它似乎在Nest 7.4.1中不存在

3.使用Visitor强制每个String都是SearchAsYouType

一切都失败了

我有一种感觉,解决方案是在 NEST.JsonNetSerializer 中以某种方式使映射中使用的设置适用于 JObject 但我找不到任何有用的东西

0 投票
1 回答
169 浏览

elasticsearch - 如何设置从完成/建议返回的结果数量?

目前,我的 Elasticsearch 服务在版本 7.4.0 上运行,而我的 C# Windows 窗体应用程序使用的是 Elasticsearch.Net 版本 7.3.1。

我注意到我可以通过设置 NumberOfFragments 来设置从突出显示返回的最大结果数,默认情况下为 5。但是,当我设置以下内容时,我无法获得返回五个以上结果的完成/建议:

执行上述查询时,我收到以下错误消息。

更新

通过添加以下内容,我设法获得了 5 个以上的结果:

但是,这一次我注意到我无法完成以返回在执行 MatchPhrase 时可以找到的单词(很多缺失的单词)。

0 投票
0 回答
122 浏览

c# - 使用对象初始化方法动态创建 ElasticSearch 查询

我正在尝试使用对象初始化方法创建一个查询模块,该方法将使用 ElasticSearch.Net 和 Nest for .Net (version x6.4)根据搜索条件动态构建 ES 查询。

所以我现在正在做的是使用以下函数创建构建块:

如果我想使用上述函数组装下面提到的查询:

但是我被上述功能困在组装查询部分。

对于组装部分,我该如何处理?请帮忙,如果我的方向是正确的,或者我在这方面做错了什么。

提前致谢!!!