Meta query returns no results
-
Hi! I’m facing a hurdle with one on my queries where I pass a meta_key / value to get custom posts with a date ( format YYYY-MM-DD ) between what has been input by the user.
Here is the meta query in question :
$meta_key = '_field_date_de_parution'; if (!empty($start) && !empty($end)) { $meta = array( array( 'key' => $meta_key, 'value' => array($start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')), 'compare' => 'BETWEEN', 'type' => 'DATE' ) ); }
I can see that the meta key is indexed in elasticsearch
"meta":{ "properties":{ "_field_date_de_parution":{ "properties":{ "boolean":{ "type":"boolean" }, "date":{ "type":"date", "format":"yyyy-MM-dd" }, "datetime":{ "type":"date", "format":"yyyy-MM-dd HH:mm:ss" }, "double":{ "type":"double" }, "long":{ "type":"long" }, "raw":{ "type":"keyword", "ignore_above":10922 }, "time":{ "type":"date", "format":"HH:mm:ss" }, "value":{ "type":"text", "fields":{ "raw":{ "type":"keyword", "ignore_above":10922 }, "sortable":{ "type":"keyword", "ignore_above":10922, "normalizer":"lowerasciinormalizer" } } } } } } },
but the search is returning no results if I pass this meta query. It does work without this query and without elasticpress activated (standard wordpress query works just fine).
I’ve added all the code to allow indexing and searching into private meta key, but I can’t get this one to return anything.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Meta query returns no results’ is closed to new replies.