问题标签 [elasticsearch-dsl]

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 投票
2 回答
7851 浏览

python - What is the Elasticsearch-py equivalent to alias actions?

I am trying to implement multiples indices approach using elasticsearch-dsl. There are basically two steps:

1. Create aliases:

2. Change alias when necessary:

I could only implement the step 1 using elasticsearch-py (not the dsl):

I have no clue how to do that for step 2. So, what would be the equivalent in elasticsearch-dsl (or at least in elasticsearch-py)?

0 投票
2 回答
2700 浏览

elasticsearch - 多元素词条查询的性能

我计划Terms Query在我的所有查询中使用包含许多术语(取决于情况,最多 40-50k 术语)。

这些术语将使用此处解释的查找从另一个索引中获取。Elasticsearch 在内部使用它们,因此至少它们不会通过线路,但查询本身看起来很繁重。

我想知道查询性能是否会很好。无论如何,我正计划进行压力测试,但不确定这是否会很好地升级。有人对这类查询有过经验,或者知道 Elasticsearch 如何在内部处理它们?

谢谢!

0 投票
3 回答
7501 浏览

python - Elasticsearch-dsl sort, find last X entries

I'm trying to find the last 30 entries into my index/doc type

I've tried nothing and I'm all out of ideas!

My current approach I find all the results over the last 5 minutes, then filter through the results and grab out the last 30 entries, but this is slower than the correct approach.

And I've tried

0 投票
0 回答
287 浏览

sorting - 在 ElasticSearch 中执行没有 inner_hits 的嵌套排序

我需要一些关于从ELlasticSearch (1.7.3)查询记录的帮助。我们将获得执行的评估列表,并仅显示最后完成的评估,如下所示:

现在我们需要根据最近执行的评估来查询记录,即只查询评估数组的最后一个对象。我们发现支持 inner_hits 对嵌套记录进行排序和限制。为此,我们编写了一个查询以 evaluation id按 desc 顺序排序,并将其大小限制为 1,如下所示:

请在下面找到映射:

我们尝试对记录进行排序,但没有成功,您能否建议一些其他方法来搜索嵌套记录的最后一个对象。

谢谢。

0 投票
1 回答
2691 浏览

elasticsearch - 弹性搜索 - 如何使用带有 UTF-8 过滤器的语言分析器?

我对 ElasticSearch 语言分析器有疑问。我正在研究立陶宛语,所以我正在使用立陶宛语分析器。分析器工作正常,我得到了我需要的所有单词大小写。例如,我索引立陶宛城市“克莱佩达”:

问题是,当我仅在拉丁字母(“Klaipeda”)和所有立陶宛语案例中搜索“Klaipeda”时,我还需要得到一个结果:

  1. 主格:“克莱佩达”
  2. 属格:“克莱佩多斯”
  3. ...
  4. 定位案例:“克莱佩多耶”

“克莱佩达”、“克莱佩多斯”、“克莱佩多耶” - 有效,但“克莱佩达”、“克莱佩多斯”、“克莱佩多耶” - 不奏效。

我的索引:

和搜索查询:

我做错了什么?感谢帮助。

0 投票
1 回答
305 浏览

django - 通过 Django 代理我的 Elastic Search 连接以进行过滤

我相信我需要通过 Django URL 代理我的 ElasticSearch 连接,以便按用户令牌进行过滤。

localhost:9200/_search所以我不想使用via ,而是使用localhost:8000/myapi/elastic/_search.

我不确定如何连接它们。我试过使用序列化器/视图设置

myapp/search.py

api/serializers.py

从 myapp.search 导入任务索引

api/views.py

api/urls.py

0 投票
2 回答
181 浏览

ruby - 如何在弹性搜索中结合 3 个术语?

我的搜索需要结合我的用户的三个不同术语:

user_locked? || (user_expired? && !user_granted?)

这是我现在得到的,但它会引发错误消息:

错误信息:

NoMethodError: undefined method 'filter' for #<Elasticsearch::DSL::Search::Filters::Bool

知道如何解决这个问题甚至更好的查询吗?

0 投票
1 回答
131 浏览

elasticsearch - Elasticsearch DSL 查询到 .Net NEST

我正在尝试将以下弹性搜索 DSL 转换为 NEST 查询,我使用的是弹性搜索 5.2 版

到目前为止,我得到了以下内容,我知道过滤器部分不应该在那里,但我似乎无法添加嵌套部分没有它

0 投票
1 回答
219 浏览

elasticsearch - ElasticSearch 在嵌套字段上聚合

我有一个具有以下结构的索引。

映射看起来像

我正在使用以下 DSL 查询来搜索“内容”和“标题”字段,并将结果缩小到某个“标签名称”。然后使用聚合来计算该查询中的 tagNames。

“tagNames”的搜索查询和过滤器工作正常。然而,聚合并不完全有效。它似乎没有在结果中包含嵌套查询数据。返回的聚合结果只是基于多匹配搜索。

如何在聚合中包含嵌套查询。

样本文件在

https://gist.github.com/anonymous/83bc2b1bfa0ac0d295d42297e1d76c00

0 投票
1 回答
713 浏览

python - 将 Python elastisearch_dsl 与嵌套对象一起使用

我想尝试将 elasticsearch_dsl 与 python 一起使用以进行以下操作

我能够获得第一个查询,但不确定第二个

不确定如何使用 DSL 对嵌套对象 party.phoneList.phoneFullNumber 进行查询

ES 新手,因此无法弄清楚如何执行嵌套对象。我查看了 https://github.com/elastic/elasticsearch-dsl-py/issues/28并不太明白。

谢谢 !