BUG: sort error when value is missing
Describe the bug
Hello,
On a multisite WP, we use a query in order to retrieve post of type "event" and sort them by "spf_event_start_date" field. If the site has posts of type event in its database, it' ok. If there are no "event" posts in the database, we get the following error:
Error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on Recommended Solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
The meta has been added using the filter ep_prepare_meta_allowed_keys. I have also tried to manually add it to the mapping but it didn't change anything.
Here is the query:
{
"from": 0,
"size": 10000,
"post_filter": {
"bool": {
"must": [
{
"bool": {
"must_not": {
"terms": {
"post_id": [
15971
]
}
}
}
},
{
"bool": {
"must": [
{
"exists": {
"field": "meta.spf_event_start_date"
}
},
{
"bool": {
"must": {
"bool": {
"must": [
{
"bool": {
"should": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"range": {
"meta.spf_event_start_date.date": {
"gte": "2024-07-11"
}
}
}
]
}
},
{
"bool": {
"must": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"range": {
"meta.spf_event_start_date.date": {
"lte": "2024-07-11"
}
}
}
]
}
},
{
"bool": {
"must": [
{
"range": {
"meta.spf_event_end_date.date": {
"gte": "2024-07-11"
}
}
}
]
}
}
]
}
}
}
}
]
}
}
}
},
{
"bool": {
"should": {
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"terms": {
"meta.spf_content_is_featured.raw": [
1
]
}
}
]
}
},
{
"bool": {
"must_not": [
{
"exists": {
"field": "meta.spf_content_is_featured"
}
}
]
}
}
]
}
}
}
}
]
}
}
}
}
]
}
},
{
"terms": {
"post_type.raw": [
"event"
]
}
},
{
"terms": {
"post_status": [
"publish",
"acf-disabled"
]
}
}
]
}
},
"query": {
"match_all": {
"boost": 1
}
},
"_source": {
"includes": [
"post_id"
]
},
"sort": [
{
"meta.spf_event_start_date.value.sortable": {
"order": "asc"
}
}
]
}
Steps to Reproduce
If necessary I will see if it's possible to enable debug-bar-elasticpress on the production env for you to see the errors
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress and ElasticPress information
Failed Queries
https://www.secourspopulaire.fr/58 (2024-07-11 11:45:47)
error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on
recommended_solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
es_req: POST http://ipvr8.secours-populaire:9200/spfpro-post-401/_search
request_id: spfpro248dedc474c84347b1e3186cc7a4546f
query_time: 1.8458366394043
wp_args: array (
'ignore_sticky_posts' => 1,
'post_type' => 'event',
'offset' => 0,
'post__not_in' =>
array (
0 => 15971,
),
'posts_per_page' => -1,
'ep_integrate' => true,
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',
'subpost' => '',
'subpost_id' => '',
'attachment' => '',
'attachment_id' => 0,
'name' => '',
'pagename' => '',
'page_id' => 0,
'second' => '',
'minute' => '',
'hour' => '',
'day' => 0,
'monthnum' => 0,
'year' => 0,
'w' => 0,
'category_name' => '',
'tag' => '',
'cat' => '',
'tag_id' => '',
'author' => '',
'author_name' => '',
'feed' => '',
'tb' => '',
'paged' => 1,
'meta_key' => 'spf_event_start_date',
'meta_value' => '',
'preview' => '',
's' => '',
'sentence' => '',
'title' => '',
'fields' => 'ids',
'menu_order' => '',
'embed' => '',
'category__in' =>
array (
),
'category__not_in' =>
array (
),
'category__and' =>
array (
),
'post__in' =>
array (
),
'post_name__in' =>
array (
),
'tag__in' =>
array (
),
'tag__not_in' =>
array (
),
'tag__and' =>
array (
),
'tag_slug__in' =>
array (
),
'tag_slug__and' =>
array (
),
'post_parent__in' =>
array (
),
'post_parent__not_in' =>
array (
),
'author__in' =>
array (
),
'author__not_in' =>
array (
),
'search_columns' =>
array (
),
'spf_events_integrate' => 'future',
'spf_featured_integrate' => false,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' =>
array (
'spf_future_events' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
1 =>
array (
'relation' => 'AND',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '<=',
'type' => 'DATE',
),
1 =>
array (
'key' => 'spf_event_end_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
),
),
'spf_featured' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_content_is_featured',
'value' => 1,
'compare' => '!=',
),
1 =>
array (
'key' => 'spf_content_is_featured',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
),
'cache_results' => false,
'facetwp' => false,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'no_found_rows' => true,
'nopaging' => true,
'suppress_filters' => false,
'update_menu_item_cache' => false,
'lazy_load_term_meta' => false,
'comments_per_page' => '50',
)
status_code: 400
body: {"from":0,"size":10000,"post_filter":{"bool":{"must":[{"bool":{"must_not":{"terms":{"post_id":[15971]}}}},{"bool":{"must":[{"exists":{"field":"meta.spf_event_start_date"}},{"bool":{"must":{"bool":{"must":[{"bool":{"should":{"bool":{"should":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"gte":"2024-07-11"}}}]}},{"bool":{"must":{"bool":{"must":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"lte":"2024-07-11"}}}]}},{"bool":{"must":[{"range":{"meta.spf_event_end_date.date":{"gte":"2024-07-11"}}}]}}]}}}}]}}}},{"bool":{"should":{"bool":{"should":[{"bool":{"must_not":[{"terms":{"meta.spf_content_is_featured.raw":[1]}}]}},{"bool":{"must_not":[{"exists":{"field":"meta.spf_content_is_featured"}}]}}]}}}}]}}}}]}},{"terms":{"post_type.raw":["event"]}},{"terms":{"post_status":["publish","acf-disabled"]}}]}},"query":{"match_all":{"boost":1}},"_source":{"includes":["post_id"]},"sort":[{"meta.spf_event_start_date.value.sortable":{"order":"asc"}}]}
result: array (
'error' =>
array (
'root_cause' =>
array (
0 =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => '0DJolzJmRIaLEKjXXcsmLA',
'index' => 'spfpro-post-401',
),
),
'type' => 'search_phase_execution_exception',
'reason' => 'all shards failed',
'phase' => 'can_match',
'grouped' => true,
'failed_shards' =>
array (
0 =>
array (
'shard' => 0,
'index' => 'spfpro-post-401',
'node' => 'XQarS25iTM6qGz2uyyKpcg',
'reason' =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => '0DJolzJmRIaLEKjXXcsmLA',
'index' => 'spfpro-post-401',
),
),
),
),
'status' => 400,
)
https://www.secourspopulaire.fr/75 (2024-07-11 11:45:44)
error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on
recommended_solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
es_req: POST http://ipvr8.secours-populaire:9200/spfpro-post-437/_search
request_id: spfpro4cd68eadb8ed45caa954577341c0388c
query_time: 1.2919902801514
wp_args: array (
'ignore_sticky_posts' => 1,
'post_type' => 'event',
'offset' => 0,
'post__not_in' =>
array (
0 => 15971,
),
'posts_per_page' => 3,
'ep_integrate' => true,
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',
'subpost' => '',
'subpost_id' => '',
'attachment' => '',
'attachment_id' => 0,
'name' => '',
'pagename' => '',
'page_id' => 0,
'second' => '',
'minute' => '',
'hour' => '',
'day' => 0,
'monthnum' => 0,
'year' => 0,
'w' => 0,
'category_name' => '',
'tag' => '',
'cat' => '',
'tag_id' => '',
'author' => '',
'author_name' => '',
'feed' => '',
'tb' => '',
'paged' => 0,
'meta_key' => 'spf_event_start_date',
'meta_value' => '',
'preview' => '',
's' => '',
'sentence' => '',
'title' => '',
'fields' => '',
'menu_order' => '',
'embed' => '',
'category__in' =>
array (
),
'category__not_in' =>
array (
),
'category__and' =>
array (
),
'post__in' =>
array (
),
'post_name__in' =>
array (
),
'tag__in' =>
array (
),
'tag__not_in' =>
array (
),
'tag__and' =>
array (
),
'tag_slug__in' =>
array (
),
'tag_slug__and' =>
array (
),
'post_parent__in' =>
array (
),
'post_parent__not_in' =>
array (
),
'author__in' =>
array (
),
'author__not_in' =>
array (
),
'search_columns' =>
array (
),
'spf_events_integrate' => 'future',
'spf_featured_integrate' => false,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' =>
array (
'spf_future_events' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
1 =>
array (
'relation' => 'AND',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '<=',
'type' => 'DATE',
),
1 =>
array (
'key' => 'spf_event_end_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
),
),
'spf_featured' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_content_is_featured',
'value' => 1,
'compare' => '!=',
),
1 =>
array (
'key' => 'spf_content_is_featured',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
),
'cache_results' => false,
'facetwp' => true,
'suppress_filters' => false,
'update_post_term_cache' => true,
'update_menu_item_cache' => false,
'lazy_load_term_meta' => true,
'update_post_meta_cache' => true,
'nopaging' => false,
'comments_per_page' => '50',
'no_found_rows' => false,
)
status_code: 400
body: {"from":0,"size":3,"post_filter":{"bool":{"must":[{"bool":{"must_not":{"terms":{"post_id":[15971]}}}},{"bool":{"must":[{"exists":{"field":"meta.spf_event_start_date"}},{"bool":{"must":{"bool":{"must":[{"bool":{"should":{"bool":{"should":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"gte":"2024-07-11"}}}]}},{"bool":{"must":{"bool":{"must":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"lte":"2024-07-11"}}}]}},{"bool":{"must":[{"range":{"meta.spf_event_end_date.date":{"gte":"2024-07-11"}}}]}}]}}}}]}}}},{"bool":{"should":{"bool":{"should":[{"bool":{"must_not":[{"terms":{"meta.spf_content_is_featured.raw":[1]}}]}},{"bool":{"must_not":[{"exists":{"field":"meta.spf_content_is_featured"}}]}}]}}}}]}}}}]}},{"terms":{"post_type.raw":["event"]}},{"terms":{"post_status":["publish","acf-disabled"]}}]}},"query":{"match_all":{"boost":1}},"sort":[{"meta.spf_event_start_date.value.sortable":{"order":"asc"}}]}
result: array (
'error' =>
array (
'root_cause' =>
array (
0 =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
'type' => 'search_phase_execution_exception',
'reason' => 'all shards failed',
'phase' => 'can_match',
'grouped' => true,
'failed_shards' =>
array (
0 =>
array (
'shard' => 0,
'index' => 'spfpro-post-437',
'node' => 'XQarS25iTM6qGz2uyyKpcg',
'reason' =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
),
),
'status' => 400,
)
https://www.secourspopulaire.fr/75 (2024-07-11 11:45:44)
error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on
recommended_solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
es_req: POST http://ipvr8.secours-populaire:9200/spfpro-post-437/_search
request_id: spfproaaa6877a78324c22bc7e54ac2a67e3ef
query_time: 1.36399269104
wp_args: array (
'ignore_sticky_posts' => 1,
'post_type' => 'event',
'offset' => 0,
'post__not_in' =>
array (
0 => 15971,
),
'posts_per_page' => 3,
'ep_integrate' => true,
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',
'subpost' => '',
'subpost_id' => '',
'attachment' => '',
'attachment_id' => 0,
'name' => '',
'pagename' => '',
'page_id' => 0,
'second' => '',
'minute' => '',
'hour' => '',
'day' => 0,
'monthnum' => 0,
'year' => 0,
'w' => 0,
'category_name' => '',
'tag' => '',
'cat' => '',
'tag_id' => '',
'author' => '',
'author_name' => '',
'feed' => '',
'tb' => '',
'paged' => 1,
'meta_key' => 'spf_event_start_date',
'meta_value' => '',
'preview' => '',
's' => '',
'sentence' => '',
'title' => '',
'fields' => '',
'menu_order' => '',
'embed' => '',
'category__in' =>
array (
),
'category__not_in' =>
array (
),
'category__and' =>
array (
),
'post__in' =>
array (
),
'post_name__in' =>
array (
),
'tag__in' =>
array (
),
'tag__not_in' =>
array (
),
'tag__and' =>
array (
),
'tag_slug__in' =>
array (
),
'tag_slug__and' =>
array (
),
'post_parent__in' =>
array (
),
'post_parent__not_in' =>
array (
),
'author__in' =>
array (
),
'author__not_in' =>
array (
),
'search_columns' =>
array (
),
'spf_events_integrate' => 'future',
'spf_featured_integrate' => false,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' =>
array (
'spf_future_events' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
1 =>
array (
'relation' => 'AND',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '<=',
'type' => 'DATE',
),
1 =>
array (
'key' => 'spf_event_end_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
),
),
'spf_featured' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_content_is_featured',
'value' => 1,
'compare' => '!=',
),
1 =>
array (
'key' => 'spf_content_is_featured',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
),
'cache_results' => false,
'facetwp' => true,
'suppress_filters' => false,
'update_post_term_cache' => true,
'update_menu_item_cache' => false,
'lazy_load_term_meta' => true,
'update_post_meta_cache' => true,
'nopaging' => false,
'comments_per_page' => '50',
'no_found_rows' => false,
)
status_code: 400
body: {"from":0,"size":3,"post_filter":{"bool":{"must":[{"bool":{"must_not":{"terms":{"post_id":[15971]}}}},{"bool":{"must":[{"exists":{"field":"meta.spf_event_start_date"}},{"bool":{"must":{"bool":{"must":[{"bool":{"should":{"bool":{"should":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"gte":"2024-07-11"}}}]}},{"bool":{"must":{"bool":{"must":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"lte":"2024-07-11"}}}]}},{"bool":{"must":[{"range":{"meta.spf_event_end_date.date":{"gte":"2024-07-11"}}}]}}]}}}}]}}}},{"bool":{"should":{"bool":{"should":[{"bool":{"must_not":[{"terms":{"meta.spf_content_is_featured.raw":[1]}}]}},{"bool":{"must_not":[{"exists":{"field":"meta.spf_content_is_featured"}}]}}]}}}}]}}}}]}},{"terms":{"post_type.raw":["event"]}},{"terms":{"post_status":["publish","acf-disabled"]}}]}},"query":{"match_all":{"boost":1}},"sort":[{"meta.spf_event_start_date.value.sortable":{"order":"asc"}}]}
result: array (
'error' =>
array (
'root_cause' =>
array (
0 =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
'type' => 'search_phase_execution_exception',
'reason' => 'all shards failed',
'phase' => 'can_match',
'grouped' => true,
'failed_shards' =>
array (
0 =>
array (
'shard' => 0,
'index' => 'spfpro-post-437',
'node' => 'XQarS25iTM6qGz2uyyKpcg',
'reason' =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
),
),
'status' => 400,
)
https://www.secourspopulaire.fr/75 (2024-07-11 11:45:44)
error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on
recommended_solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
es_req: POST http://ipvr8.secours-populaire:9200/spfpro-post-437/_search
request_id: spfpro89d59e4ede974a57806e99d50d050600
query_time: 1.4488697052002
wp_args: array (
'ignore_sticky_posts' => 1,
'post_type' => 'event',
'offset' => 0,
'post__not_in' =>
array (
0 => 15971,
),
'posts_per_page' => -1,
'ep_integrate' => true,
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',
'subpost' => '',
'subpost_id' => '',
'attachment' => '',
'attachment_id' => 0,
'name' => '',
'pagename' => '',
'page_id' => 0,
'second' => '',
'minute' => '',
'hour' => '',
'day' => 0,
'monthnum' => 0,
'year' => 0,
'w' => 0,
'category_name' => '',
'tag' => '',
'cat' => '',
'tag_id' => '',
'author' => '',
'author_name' => '',
'feed' => '',
'tb' => '',
'paged' => 1,
'meta_key' => 'spf_event_start_date',
'meta_value' => '',
'preview' => '',
's' => '',
'sentence' => '',
'title' => '',
'fields' => 'ids',
'menu_order' => '',
'embed' => '',
'category__in' =>
array (
),
'category__not_in' =>
array (
),
'category__and' =>
array (
),
'post__in' =>
array (
),
'post_name__in' =>
array (
),
'tag__in' =>
array (
),
'tag__not_in' =>
array (
),
'tag__and' =>
array (
),
'tag_slug__in' =>
array (
),
'tag_slug__and' =>
array (
),
'post_parent__in' =>
array (
),
'post_parent__not_in' =>
array (
),
'author__in' =>
array (
),
'author__not_in' =>
array (
),
'search_columns' =>
array (
),
'spf_events_integrate' => 'future',
'spf_featured_integrate' => false,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' =>
array (
'spf_future_events' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
1 =>
array (
'relation' => 'AND',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '<=',
'type' => 'DATE',
),
1 =>
array (
'key' => 'spf_event_end_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
),
),
'spf_featured' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_content_is_featured',
'value' => 1,
'compare' => '!=',
),
1 =>
array (
'key' => 'spf_content_is_featured',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
),
'cache_results' => false,
'facetwp' => false,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'no_found_rows' => true,
'nopaging' => true,
'suppress_filters' => false,
'update_menu_item_cache' => false,
'lazy_load_term_meta' => false,
'comments_per_page' => '50',
)
status_code: 400
body: {"from":0,"size":10000,"post_filter":{"bool":{"must":[{"bool":{"must_not":{"terms":{"post_id":[15971]}}}},{"bool":{"must":[{"exists":{"field":"meta.spf_event_start_date"}},{"bool":{"must":{"bool":{"must":[{"bool":{"should":{"bool":{"should":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"gte":"2024-07-11"}}}]}},{"bool":{"must":{"bool":{"must":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"lte":"2024-07-11"}}}]}},{"bool":{"must":[{"range":{"meta.spf_event_end_date.date":{"gte":"2024-07-11"}}}]}}]}}}}]}}}},{"bool":{"should":{"bool":{"should":[{"bool":{"must_not":[{"terms":{"meta.spf_content_is_featured.raw":[1]}}]}},{"bool":{"must_not":[{"exists":{"field":"meta.spf_content_is_featured"}}]}}]}}}}]}}}}]}},{"terms":{"post_type.raw":["event"]}},{"terms":{"post_status":["publish","acf-disabled"]}}]}},"query":{"match_all":{"boost":1}},"_source":{"includes":["post_id"]},"sort":[{"meta.spf_event_start_date.value.sortable":{"order":"asc"}}]}
result: array (
'error' =>
array (
'root_cause' =>
array (
0 =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
'type' => 'search_phase_execution_exception',
'reason' => 'all shards failed',
'phase' => 'can_match',
'grouped' => true,
'failed_shards' =>
array (
0 =>
array (
'shard' => 0,
'index' => 'spfpro-post-437',
'node' => 'XQarS25iTM6qGz2uyyKpcg',
'reason' =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'l9NXeI_xT2mo3-KQIDsDtg',
'index' => 'spfpro-post-437',
),
),
),
),
'status' => 400,
)
https://www.secourspopulaire.fr/44-nantes (2024-07-11 11:45:43)
error: No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on
recommended_solution: The field meta.spf_event_start_date.value.sortable was not found. Make sure it is added to the list of indexed fields and run a new sync to fix the issue.
es_req: POST http://ipvr8.secours-populaire:9200/spfpro-post-1647/_search
request_id: spfprob7f7867bab7a4ff2862b5af06f6afdc5
query_time: 1.417875289917
wp_args: array (
'ignore_sticky_posts' => 1,
'post_type' => 'event',
'offset' => 0,
'post__not_in' =>
array (
0 => 15971,
),
'posts_per_page' => 3,
'ep_integrate' => true,
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',
'subpost' => '',
'subpost_id' => '',
'attachment' => '',
'attachment_id' => 0,
'name' => '',
'pagename' => '',
'page_id' => 0,
'second' => '',
'minute' => '',
'hour' => '',
'day' => 0,
'monthnum' => 0,
'year' => 0,
'w' => 0,
'category_name' => '',
'tag' => '',
'cat' => '',
'tag_id' => '',
'author' => '',
'author_name' => '',
'feed' => '',
'tb' => '',
'paged' => 0,
'meta_key' => 'spf_event_start_date',
'meta_value' => '',
'preview' => '',
's' => '',
'sentence' => '',
'title' => '',
'fields' => '',
'menu_order' => '',
'embed' => '',
'category__in' =>
array (
),
'category__not_in' =>
array (
),
'category__and' =>
array (
),
'post__in' =>
array (
),
'post_name__in' =>
array (
),
'tag__in' =>
array (
),
'tag__not_in' =>
array (
),
'tag__and' =>
array (
),
'tag_slug__in' =>
array (
),
'tag_slug__and' =>
array (
),
'post_parent__in' =>
array (
),
'post_parent__not_in' =>
array (
),
'author__in' =>
array (
),
'author__not_in' =>
array (
),
'search_columns' =>
array (
),
'spf_events_integrate' => 'future',
'spf_featured_integrate' => false,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' =>
array (
'spf_future_events' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
1 =>
array (
'relation' => 'AND',
0 =>
array (
'key' => 'spf_event_start_date',
'value' => '2024-07-11',
'compare' => '<=',
'type' => 'DATE',
),
1 =>
array (
'key' => 'spf_event_end_date',
'value' => '2024-07-11',
'compare' => '>=',
'type' => 'DATE',
),
),
),
'spf_featured' =>
array (
'relation' => 'OR',
0 =>
array (
'key' => 'spf_content_is_featured',
'value' => 1,
'compare' => '!=',
),
1 =>
array (
'key' => 'spf_content_is_featured',
'value' => '',
'compare' => 'NOT EXISTS',
),
),
),
'cache_results' => false,
'suppress_filters' => false,
'update_post_term_cache' => true,
'update_menu_item_cache' => false,
'lazy_load_term_meta' => true,
'update_post_meta_cache' => true,
'nopaging' => false,
'comments_per_page' => '50',
'no_found_rows' => false,
)
status_code: 400
body: {"from":0,"size":3,"post_filter":{"bool":{"must":[{"bool":{"must_not":{"terms":{"post_id":[15971]}}}},{"bool":{"must":[{"exists":{"field":"meta.spf_event_start_date"}},{"bool":{"must":{"bool":{"must":[{"bool":{"should":{"bool":{"should":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"gte":"2024-07-11"}}}]}},{"bool":{"must":{"bool":{"must":[{"bool":{"must":[{"range":{"meta.spf_event_start_date.date":{"lte":"2024-07-11"}}}]}},{"bool":{"must":[{"range":{"meta.spf_event_end_date.date":{"gte":"2024-07-11"}}}]}}]}}}}]}}}},{"bool":{"should":{"bool":{"should":[{"bool":{"must_not":[{"terms":{"meta.spf_content_is_featured.raw":[1]}}]}},{"bool":{"must_not":[{"exists":{"field":"meta.spf_content_is_featured"}}]}}]}}}}]}}}}]}},{"terms":{"post_type.raw":["event"]}},{"terms":{"post_status":["publish","acf-disabled"]}}]}},"query":{"match_all":{"boost":1}},"sort":[{"meta.spf_event_start_date.value.sortable":{"order":"asc"}}]}
result: array (
'error' =>
array (
'root_cause' =>
array (
0 =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'Gok3GPfsRY6KLmVy2RwgNQ',
'index' => 'spfpro-post-1647',
),
),
'type' => 'search_phase_execution_exception',
'reason' => 'all shards failed',
'phase' => 'can_match',
'grouped' => true,
'failed_shards' =>
array (
0 =>
array (
'shard' => 0,
'index' => 'spfpro-post-1647',
'node' => 'XQarS25iTM6qGz2uyyKpcg',
'reason' =>
array (
'type' => 'query_shard_exception',
'reason' => 'No mapping found for [meta.spf_event_start_date.value.sortable] in order to sort on',
'index_uuid' => 'Gok3GPfsRY6KLmVy2RwgNQ',
'index' => 'spfpro-post-1647',
),
),
),
),
'status' => 400,
)
WordPress
WordPress Environment
wp_version: 6.5.3 home_url: https://www.secourspopulaire.fr site_url: https://www.secourspopulaire.fr/wp is_multisite: true theme: Secours Populaire UAS (1.0.0) plugins: ACF Medium Editor Field (3.0.0), Advanced Custom Fields: SVG Icon (2.1.3), Advanced Custom Fields PRO (6.2.10), Advanced Responsive Images (4.1.2), Anchor Block (2.0.2), BBQ Pro (3.7), BEA - Content Sync Fusion (3.12.3), BeAPI - ElasticPress Geo (0.2.0), Be API Dynamic block (1.0.8), Be API Icon block (2.1.4), Be API Manual Block (1.0.8), Cache-Control (2.2.5), Connect Matomo (1.0.30), Disable All WordPress Updates (1.7.0), Disable Block Editor FullScreen mode (2.7.2), Disable Comments (2.4.6), Disable Embeds (1.5.0), Disable Emojis (GDPR friendly) (1.7.6), Disable Gutenberg (3.1.1), DynaMo (1.2), ElasticPress (5.0.2), Enable Media Replace (4.1.5), FacetWP (4.2.12), Gravity Forms (2.8.5.1), GTM4WP (1.16.2), Multisite Enhancements (1.6.1), Multisite Shared Blocks (1.1.1), New Relic Reporting for WordPress (1.3.2), OpenID Connect Generic (3.9.1), OpenID Connect Generic PKCE Addon (1.0.0), Redirection (5.3.6), Redis Object Cache (2.2.3), Related Posts for WordPress Premium (2.1.2), Safe SVG (2.2.4), Secours populaire français - Actions (1.0.0), Secours populaire français - Actions rapides (1.0.0), Secours populaire français - Anonymisation des utilisateurs (1.0.0), Secours populaire français - Atrium (1.0.0), Secours populaire français - Blocs (1.0.0), Secours populaire français - Campagnes (1.0.0), Secours populaire français - Contenus à la une (1.0.0), Secours populaire français - Dolist (1.0.0), Secours populaire français - Données structurées (1.0.0), Secours populaire français - Dynamic Block Extention (1.0.0), Secours populaire français - Elasticpress (1.0.0), Secours populaire français - Events (1.0.0), Secours populaire français - FAQS (1.0.0), Secours populaire français - Gravity Forms (1.0.0), Secours populaire français - Inbenta Chatbot (1.2.5), Secours populaire français - iRaiser (1.0.0), Secours Populaire Français - Keepeek (1.0.0), Secours populaire français - Medias (1.0.0), Secours populaire français - Mobilisation d'urgence (1.0.0), Secours populaire français - Mots clés (1.0.0), Secours populaire français - News (1.0.0), Secours populaire français - Ordre personnalisé du menu (1.0.0), Secours populaire français - Pages (1.0.0), Secours populaire français - Pays (1.0.0), Secours populaire français - Presse (1.0.0), Secours populaire français - Recherche (1.0.0), Secours populaire français - Sitemap (1.0.0), Secours populaire français - SSO (1.0.0), Secours populaire français - Tableau de bord (1.0.0), Secours populaire français - Tarte au citron (1.0.5), Secours populaire français - Thematics action (1.0.0), Secours populaire français - Témoignages (1.0.0), Secours populaire français - Utilisateurs (1.0.0), Secours populaire français - Variables dynamiques (1.0.0), Secours populaire français - Vidéos embarquées (1.0.0), Secours populaire français - Wiki (1.0.0), Stream (4.0.0), User Switching (1.7.3), Virtual Robots.txt (1.10), Wicked Folders Pro (2.23.15), WP-CLI Site Duplicator (2.0.1), WP-PageNavi (2.94.1), WP-Polls (2.77.0), WP Cerber Security, Anti-spam & Malware Scan (9.5.7), WP Rocket (3.15.6), WP Sitemap Page (1.9.2), Yoast Duplicate Post (4.5), et Yoast SEO (22.7) revisions: all
Server Environment
php_version: 8.2.20 memory_limit: 64M timeout: 300
Indexable Content
Secours populaire français — https://www.secourspopulaire.fr/wp
post_count: 652 page_count: 173 spf-action_count: 0 event_count: 667 faq_count: 48 press_count: 497 testimonial_count: 488 post_meta_keys: 2 page_meta_keys: 1 spf-action_meta_keys: 0 event_meta_keys: 3 faq_meta_keys: 0 press_meta_keys: 1 testimonial_meta_keys: 0 total-all-post-types: 3 distinct-meta-keys: ep_exclude_from_search, spf_content_is_featured, et spf_event_start_date
Fédération de l'AIN — https://www.secourspopulaire.fr/01
post_count: 0 page_count: 5 spf-action_count: 0 event_count: 0 faq_count: 0 press_count: 0 testimonial_count: 17 post_meta_keys: 0 page_meta_keys: 0 spf-action_meta_keys: 0 event_meta_keys: 0 faq_meta_keys: 0 press_meta_keys: 0 testimonial_meta_keys: 0 total-all-post-types: 0 distinct-meta-keys:
[Truncated because there are more than 1600 sites]
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@iazema can you please share the code where you are using the ep_prepare_meta_allowed_keys filter to add that meta field to the allowed list? Thanks!
Sure, it's in class that contains:
add_filter( 'ep_prepare_meta_allowed_keys', [ $this, 'add_ep_allowed_meta' ] );
public function add_ep_allowed_meta( $metas ): array {
$metas[] = 'spf_event_start_date';
$metas[] = 'spf_content_is_featured';
return $metas;
}
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open.
Hi @felipeelia
My issue has been automatically marked as stale but I did send you the code you asked me :-) Is there anything else you need?
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open.
This issue has been automatically closed because there has been no response to our request for more information in the past 3 days. With only the information that is currently available, we are unable to take further action on this ticket. Please reach out if you have found or find the answer we need so that we can investigate further. When the information is ready, you can re-open this ticket to share it with us.
Hi @felipeelia
This issue has been automatically closed but I had no answer since I sent the code you asked. Can you please look into it?
Hi @iazema,
Thank you for reporting this issue. I can confirm that it is indeed a bug in the plugin, as I was able to replicate it on my end. I have added this bug to our roadmap and we aim to fix it in the upcoming version.
Regards, Burhan
Thanks a lot Burhan
I'm a bit unclear on what the expected behavior is here. If the intent is to order by a field and ANY content has that field, isn't Elasticsearch supposed to fail?
Hi Felipe,
Only contents of type "event" have the field. The issue is that when get an error when there are no contents of type "event".
It has been 3 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 3 days, but if you have more information to add then please comment and the issue will stay open.
This issue has been automatically closed because there has been no response to our request for more information in the past 3 days. With only the information that is currently available, we are unable to take further action on this ticket. Please reach out if you have found or find the answer we need so that we can investigate further. When the information is ready, you can re-open this ticket to share it with us.
Hello, Why is this ticket closed again even though I gave an answer?
@iazema I thought I left a comment here and it seems I didn't, sorry.
We talked internally, and "fixing" it could lead to a lot of wrong results and masked problems. In the end, meta field mappings are created when the first meta field is found. If a database doesn't have any value of that meta field, the code should not be ordered by that in the first place. For edge cases like yours, you should probably create an entirely new field in the mapping and order by that instead.