美文网首页
ES 按照字段排序,忽略没有mapping的field

ES 按照字段排序,忽略没有mapping的field

作者: 良人与我 | 来源:发表于2019-06-13 19:26 被阅读0次

Ignoring Unmapped Fieldsedit
By default, the search request will fail if there is no mapping associated with a field. The unmapped_type option allows you to ignore fields that have no mapping and not sort by them. The value of this parameter is used to determine what sort values to emit. Here is an example of how it can be used:

GET /_search
{
    "sort" : [
        { "price" : {"unmapped_type" : "long"} }
    ],
    "query" : {
        "term" : { "product" : "chocolate" }
    }
}

pringboot 中

SearchQuery searchQuery = new NativeSearchQueryBuilder()
    .withSort(SortBuilders.fieldSort("price").unmappedType("keyword").order(SortOrder.DESC))

参考
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_ignoring_unmapped_fields

相关文章

  • ES 按照字段排序,忽略没有mapping的field

    Ignoring Unmapped FieldseditBy default, the search reques...

  • 功能代码块

    获取当前时间的前或后n个小时 忽略对象字段转json及忽略json field对应赋值给object field

  • elasticsearch排序

    默认按照_score排序,如果指定排序字段,_score字段不再经过计算,按照指定字段进行排序。但是如果指定字段是...

  • Elasticsearch Mapping增加一个新字段

    我们在开发过程中,经常会遇到对现有的Mapping增加字段的情况,ES不支持修改Mapping,但对Mapping...

  • ES学习笔记1

    ES对于数据上的数据模型如下:index type document field mapping与数据库的概念一...

  • 四十五、Elasticsearch初识搜索引擎-object数据

    1、object field address是object类型,里面包含三个字段。 他对应的mapping为: 2...

  • dynamic-field-mapping

    如果没有指定字段的 mappinges 会自动创建mapping,按照如下的规则 参考地址https://www....

  • ThinkPHP(四)

    连贯操作之ORDER排序 order多个条件用逗号隔开 连贯操作之field方法 field规定要查询的字段 连贯...

  • mysql中文排序

    一般排序 使用 order by 加上字段当排序字段是中文时候 比如 name ,发现没有按照字母顺序来,也没有发...

  • 【后台】列表需求说明模版

    一、列表排序 ~按两个字段有无值排序 列表默认按照【提醒时间】—【创建时间】字段排序。提醒时间字段有值,按照提示时...

网友评论

      本文标题:ES 按照字段排序,忽略没有mapping的field

      本文链接:https://www.haomeiwen.com/subject/lcjefctx.html