简体   繁体   中英

Elasticsearch and Drupal, sort: No mapping found for [field_XX] in order to sort on

In my query I want to sort results. My request doesn't generate error but "sort" doesn't work.

...[sort] => Array
(
    [0] => Array
    (
        [field_title] => Array
        (
            [order] => asc
        )
    )
)...

I work with Drupal, my index is already create. I think that I miss a mapping. But I don't know how to create a "mapping" so that "sort" works. In the elasticsearch.yml file? How?

ElasticSearch ignores unmapped field when sorting. Just try to add a mapping for the title_field

By default, the search request will fail if there is no mapping associated with a field.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM