Closed arhimed-me-account closed 3 years ago
Hello,
any replay regarding this questions?
Hi @dnikola , @arhimed-me-account ,
Can you please share more information about this? Are these custom post types hierarchical ? what features do you have activated? what is your current ElasticSearch and ElasticPress version ? what plugins do you have activated? Is there some custom code we have to be aware of? I was able to search for orders and products just fine so any information you can give to reproduce this issue will help us a lot in order to troubleshoot.
Regarding your other question, the query that is being run/wp-json/wp/v2/posts?per_page=10
should already be using ElasticPress. Hope that helps.
Hi @oscarssanchez
thanks for your kind replay!
Ok let we split this in two questions problems
I am using elasticpress addon plugin for debug bar to debug query (hope that this is the beast way I am using, if not please tell me for another tool) Here is a SS to see when i open post's page http://prntscr.com/ryc1v0 and custom posts page in wp-admin http://prntscr.com/ryc2et
So here are information asked ElasticPress plugin version: 3.4.1 Elasticsearch version | 6.8.7
and here is code how i registered this custom post's types
if ( ! function_exists('regiser_custom_post_citulja') ) {
// Register Custom Post Type
function regiser_custom_post_citulja() {
$labels = array(
'name' => _x( 'Čitulje', 'Post Type General Name', 'umrlime' ),
'singular_name' => _x( 'Čitulja', 'Post Type Singular Name', 'umrlime' ),
'menu_name' => __( 'Čitulje', 'umrlime' ),
'name_admin_bar' => __( 'Čitulja', 'umrlime' ),
'archives' => __( 'Arhiva čitulja', 'umrlime' ),
'attributes' => __( 'Item Attributes', 'umrlime' ),
'parent_item_colon' => __( 'Nadređena čitulja:', 'umrlime' ),
'all_items' => __( 'Sve čitulje', 'umrlime' ),
'add_new_item' => __( 'Dodaj novu čitulju', 'umrlime' ),
'add_new' => __( 'Dodaj novu čitulju', 'umrlime' ),
'new_item' => __( 'Nova čitulja', 'umrlime' ),
'edit_item' => __( 'Uredi čitulju', 'umrlime' ),
'update_item' => __( 'Ažuriraj čitulju', 'umrlime' ),
'view_item' => __( 'Pregledaj čitulju', 'umrlime' ),
'view_items' => __( 'Pregledaj čitulje', 'umrlime' ),
'search_items' => __( 'Pretraži čitulje', 'umrlime' ),
'not_found' => __( 'Nije pronađeno', 'umrlime' ),
'not_found_in_trash' => __( 'Nije pronađeno na otpadu', 'umrlime' ),
'featured_image' => __( 'Fotografija čitulje', 'umrlime' ),
'set_featured_image' => __( 'Podasi fotografiju čitulje', 'umrlime' ),
'remove_featured_image' => __( 'ukloni fotografiju čitulje', 'umrlime' ),
'use_featured_image' => __( 'Koristi kao fotografiju čitulje', 'umrlime' ),
'insert_into_item' => __( 'Ubaci u čitulju', 'umrlime' ),
'uploaded_to_this_item' => __( 'Dodaj za ovu čitulju', 'umrlime' ),
'items_list' => __( 'Lista čitulja', 'umrlime' ),
'items_list_navigation' => __( 'Navigacije liste čitulja', 'umrlime' ),
'filter_items_list' => __( 'Filtriraj listu čitulja', 'umrlime' ),
);
$args = array(
'label' => __( 'Čitulja', 'umrlime' ),
'description' => __( 'Online čitulje sa tipovima kao sto su umrlice, pomeni, poslednji pozdrav', 'umrlime' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes', 'post-formats' ),
'taxonomies' => array( 'tip', 'vrsta' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-id',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
//'rewrite' => array( 'slug' => 'c', 'with_front' => true ),
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'show_in_rest' => true,
);
register_post_type( 'citulja', $args );
}
add_action( 'init', 'regiser_custom_post_citulja', 0 );
}
as you can see they are not hierarchical No, regarding this plugin i haven't used any custom code Here is a list of plugins some of them are temporary active for debuging purpose
Adminimize slug: adminimize
Autoptimize slug: autoptimize
Bridge Core slug: bridge-core
Klasični uređivač slug: classic-editor
Contact Form 7 slug: contact-form-7
Easy Social Share Buttons for WordPress slug: easy-social-share-buttons3
ElasticPress slug: elasticpress
EWWW Image Optimizer slug: ewww-image-optimizer
Favorites slug: favorites
Hum slug: hum
Loco Translate slug: loco-translate
PWA for WP slug: pwa-for-wp
Redirection slug: redirection
Optimize Database after Deleting Revisions slug: rvg-optimize-database
Srpski prevod na latinici slug: srlatin
Tawk.to Live Chat slug: tawk-to-live-chat
Umrli.me / Čitulje slug: umrlime-citulje
W3 Total Cache slug: w3-total-cache
Yoast SEO slug: wordpress-seo
WP HTML Mail slug: wp-html-mail
REST API Log slug: wp-rest-api-log
Debug Bar ElasticPress slug: debug-bar-elasticpress
Debug Bar slug: debug-bar
I tried to enable option from your plugin settings and log query's but noting show up there.
Also tried plugin https://github.com/petenelson/wp-rest-api-log
I see from this plugin log that query's like /wp-json/wp/v2/posts?per_page=10 are not served from elasticsearch and query's like wp-json/wp/v2/users/?per_page=100 also, but query's like wp-json/wp/v2/search?search=something are being served from elasticsearch
Here is complete settings of ElasticPress plugin https://i.imgur.com/aGUzYVy.png
If you need any more info please let me know. Thanks!
Hello @oscarssanchez
did you had time to check something regarding this problem?
Thanks!
Hi @dnikola,
Sorry it has been a while, do you still have this problem with the latest version?
Hi @oscarssanchez ,
yes while, almost year :)
I'll need to check, just tell me what should i need to test question 1 or question 2 from my initial question
Hi @dnikola ,
Actually if both are still happening it would be great to know! Thanks!
Hi @dnikola ,
Actually if both are still happening it would be great to know! Thanks!
I am afraid that situation is same :/ do you need any aditional info?
Hi @dnikola , Thanks, I was able to reproduce both things :)
@brandwaffle this seems correct, if you register a new post type and you check the custom post list page, the query is not run through ElasticPress. The REST API also does not integrate even if s
is set like wp-json/wp/v2/posts?s=test&per_page=10
You would need to set the ep_integrate
param to both scenarios to make them run with ElasticPress
@oscarssanchez
could you please be more clear about this
You would need to set the ep_integrate param to both scenarios to make them run with ElasticPress
you mean using add_ action ‘pre_get_posts’ i should use 'ep_integrate' => true, so this will work?
Thanks!
Hi @dnikola ,
That's correct!
Hi @dnikola ,
That's correct!
ok,
i will check.
@oscarssanchez @dnikola just as a reminder, for REST API, it should be wp-json/wp/v2/posts?search=test&per_page=10
, as in the docs.
Can confirm the correct way is ?search for the REST API and queries go through when this is set.
Hello there, I have two questions:
1) I indexed all post's in WP, I have post and custom_post indexed but using debug bar as suggested i see on admin page that elasticpress repalces query's just on admin post page (where all post are listed) http://prntscr.com/rjpwj5 but on admin page where are all custom_post listed i see that there is no no query replaced http://prntscr.com/rjpx3x
On what this depends?
2) Can we replace query's that run over REST API like /wp-json/wp/v2/posts?per_page=10 with response from elasticpress?
Regards!