【问题标题】:Elasticsearch - Nest - 'Range' query on 'string'Elasticsearch - Nest - “字符串”上的“范围”查询
【发布时间】:2016-01-20 07:51:06
【问题描述】:

您能否在最新的 2.0 alpha 版本中仍然使用 neststring 进行 range 查询?或者这是否已在弹性搜索中被删除。

Documentation -- 表明它仍在 Elasticsearch 中

然而

Range -- 似乎只接受'double'。

例如

...
(sh => sh.Range(ra => ra.Field(of =>
    of.Name).LessThanOrEquals(
        !string.IsNullOrEmpty(textInputName)
            ? textInputName.ToString(): null
    ))
...

曾经在 1.7 Nest 中工作,但现在说 LessThanOrEquals 的输入必须是 double

我现在如何获取 'name' 之间的所有内容,例如,'a' 和 'f'?

编辑

我认为它在文件src/Nest/QueryDsl/TermLevel/Range/RangeQuery.cs 中被删除了here...只是找不到'为什么'....:S

【问题讨论】:

标签: elasticsearch nest


【解决方案1】:

字符串字段的范围查询现在位于the alpha2 release on nuget

(sh => sh
    .TermRange(ra => ra
        .Field(of => of.Name)
        .LessThanOrEquals(!string.IsNullOrEmpty(textInputName)
            ? textInputName.ToString()
            : null)
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多