• Resolved tobiushirogeri

    (@tobiushirogeri)


    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)
  • I think I have a related issue, if not I’ll start a new thread.

    I’m seeing the following error in newrelic a lot since updating the elasticpress plugging (I’m not sure what it all means):

    DateTime::__construct(): Failed to parse time string (1626761321) at position 8 (2): Unexpected character

    DateTime::__construct(): Failed to parse time string (1626761513) at position 8 (1): Unexpected character

    DateTime::__construct(): Failed to parse time string (a:1:{i:0;a:2:{s:7:"message";s:431:"Yoast SEO and WooCommerce can work together a lot better by adding a helper plugin. Please install Yoast WooCommerce SEO to make your life better. <a href="https://yoa.st/1o0?php_version=7.4&platform=wordpress&platform_version=5.7.2&software=free&software_version=16.7&days_active=365plus&user_language=en_AU" aria-label="More information about Yoast WooCommerce SEO" target="_blank" rel="noopener noreferrer">More information</a>.";s:7:"options";a:10:{s:4:"type";s:7:"warning";s:2:"id";s:44:"wpseo-suggested-plugin-yoast-woocommerce-seo";s:4:"user";O:7:"WP_User":8:{s:4:"data";O:8:"stdClass":10:{s:2:"ID";s:1:"6";s:10:"user_login";s:14:"martynsaunders";s:9:"user_pass";s:34:"$P$BKkZRQr9.LL5V.tqMXHbJxPc3EefSx1";s:13:"user_nicename";s:14:"martynsaunders";s:10:"user_email";s:25:"[email protected]";s:8:"user_url";s:30:"https://www.southernman.com.au";s:15:"user_registered";s:19:"2018-09-04 02:38:38";s:19:"user_activation_key";s:45:"1552790400:$P$Bsd9c2OaYF8TKG/UeAZFtJlDISQd4T0";s:11:"user_status";s:1:"0";s:12:"display_name";s:15:"Martyn Saunders";}s:2:"ID";i:6;s:4:"caps";a:1:{s:13:"administrator";b:1;}s:7:"cap_key";s:15:"wp_capabilities";s:5:"roles";a:1:{i:0;s:13:"administrator";}s:7:"allcaps";a:170:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;s:18:"manage_woocommerce";b:1;s:24:"view_woocommerce_reports";b:1;s:12:"edit_product";b:1;s:12:"read_product";b:1;s:14:"delete_product";b:1;s:13:"edit_products";b:1;s:20:"edit_others_products";b:1;s:16:"publish_products";b:1;s:21:"read_private_products";b:1;s:15:"delete_products";b:1;s:23:"delete_private_products";b:1;s:25:"delete_published_products";b:1;s:22:"delete_others_products";b:1;s:21:"edit_private_products";b:1;s:23:"edit_published_products";b:1;s:20:"manage_product_terms";b:1;s:18:"edit_product_terms";b:1;s:20:"delete_product_terms";b:1;s:20:"assign_product_terms";b:1;s:15:"edit_shop_order";b:1;s:15:"read_shop_order";b:1;s:17:"delete_shop_order";b:1;s:16:"edit_shop_orders";b:1;s:23:"edit_others_shop_orders";b:1;s:19:"publish_shop_orders";b:1;s:24:"read_private_shop_orders";b:1;s:18:"delete_shop_orders";b:1;s:26:"delete_private_shop_orders";b:1;s:28:"delete_published_shop_orders";b:1;s:25:"delete_others_shop_orders";b:1;s:24:"edit_private_shop_orders";b:1;s:26:"edit_published_shop_orders";b:1;s:23:"manage_shop_order_terms";b:1;s:21:"edit_shop_order_terms";b:1;s:23:"delete_shop_order_terms";b:1;s:23:"assign_shop_order_terms";b:1;s:16:"edit_shop_coupon";b:1;s:16:"read_shop_coupon";b:1;s:18:"delete_shop_coupon";b:1;s:17:"edit_shop_coupons";b:1;s:24:"edit

    DateTime::__construct(): Failed to parse time string (cus_Jsz0fba8R5vhku) at position 0 (c): The timezone could not be found in the database

    Plugin Contributor Felipe Elia

    (@felipeelia)

    Hey all!

    We don’t provide support here, so if you are still facing that problem, please feel free to open an issue in our GitHub repository. It would help a lot if you could install Debug Bar and Debug Bar ElasticPress and share the query being generated by ElasticPress when you open that GH issue.

    As all next steps will be taken on GitHub, I’m marking this topic as resolved.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Meta query returns no results’ is closed to new replies.