Closed ghost closed 6 years ago
Hello @FrieseNiels how many posts do you have on your site?
Have you run WP-CLI wp elasticpress index --setup
?
What is the output of the debug bar you are trying to get to work?
Ofcourse I ran the wp elasticpress index --setup
. It's about 3700 posts, all the data is ready in Elastic Search.
The output from the debug bar
of the query args is:
array(72) { ["s"]=> string(4) "data" ["category_name"]=> string(14) "search-results" ["error"]=> string(0) "" ["m"]=> string(0) "" ["p"]=> int(0) ["post_parent"]=> string(0) "" ["subpost"]=> string(0) "" ["subpost_id"]=> string(0) "" ["attachment"]=> string(0) "" ["attachment_id"]=> int(0) ["name"]=> string(0) "" ["static"]=> string(0) "" ["pagename"]=> string(0) "" ["page_id"]=> int(0) ["second"]=> string(0) "" ["minute"]=> string(0) "" ["hour"]=> string(0) "" ["day"]=> int(0) ["monthnum"]=> int(0) ["year"]=> int(0) ["w"]=> int(0) ["tag"]=> string(0) "" ["cat"]=> string(0) "" ["tag_id"]=> string(0) "" ["author"]=> string(0) "" ["author_name"]=> string(0) "" ["feed"]=> string(0) "" ["tb"]=> string(0) "" ["paged"]=> int(0) ["meta_key"]=> string(0) "" ["meta_value"]=> string(0) "" ["preview"]=> string(0) "" ["sentence"]=> string(0) "" ["title"]=> string(0) "" ["fields"]=> string(0) "" ["menu_order"]=> string(0) "" ["embed"]=> string(0) "" ["category__in"]=> array(0) { } ["category__not_in"]=> array(0) { } ["category__and"]=> array(0) { } ["post__in"]=> array(0) { } ["post__not_in"]=> array(0) { } ["post_name__in"]=> array(0) { } ["tag__in"]=> array(0) { } ["tag__not_in"]=> array(0) { } ["tag__and"]=> array(0) { } ["tag_slug__in"]=> array(0) { } ["tag_slug__and"]=> array(0) { } ["post_parent__in"]=> array(0) { } ["post_parent__not_in"]=> array(0) { } ["author__in"]=> array(0) { } ["author__not_in"]=> array(0) { } ["cache_results"]=> bool(false) ["ep_integrate"]=> bool(true) ["ep_facet"]=> bool(true) ["aggs"]=> array(3) { ["name"]=> string(5) "terms" ["use-filter"]=> bool(true) ["aggs"]=> array(5) { ["category"]=> array(1) { ["terms"]=> array(2) { ["size"]=> int(10000) ["field"]=> string(19) "terms.category.slug" } } ["post_tag"]=> array(1) { ["terms"]=> array(2) { ["size"]=> int(10000) ["field"]=> string(19) "terms.post_tag.slug" } } ["post_format"]=> array(1) { ["terms"]=> array(2) { ["size"]=> int(10000) ["field"]=> string(22) "terms.post_format.slug" } } ["author"]=> array(1) { ["terms"]=> array(2) { ["size"]=> int(10000) ["field"]=> string(17) "terms.author.slug" } } ["subject"]=> array(1) { ["terms"]=> array(2) { ["size"]=> int(10000) ["field"]=> string(18) "terms.subject.slug" } } } } ["tax_query"]=> array(0) { } ["search_fields"]=> array(5) { [0]=> string(10) "post_title" [1]=> string(12) "post_content" [2]=> string(12) "post_excerpt" [3]=> string(11) "author_name" ["taxonomies"]=> array(2) { [0]=> string(8) "post_tag" [1]=> string(8) "category" } } ["ignore_sticky_posts"]=> bool(false) ["suppress_filters"]=> bool(false) ["update_post_term_cache"]=> bool(true) ["lazy_load_term_meta"]=> bool(true) ["update_post_meta_cache"]=> bool(true) ["post_type"]=> string(3) "any" ["posts_per_page"]=> int(10) ["nopaging"]=> bool(false) ["comments_per_page"]=> string(2) "50" ["no_found_rows"]=> bool(false) ["search_terms_count"]=> int(1) ["search_terms"]=> array(1) { [0]=> string(4) "data" } ["search_orderby_title"]=> array(1) { [0]=> string(163) "od_posts.post_title LIKE '{b339d641da14796ac6c001de14cd3f02f77a8fdca78be1a01533b0e8f191512f}data{b339d641da14796ac6c001de14cd3f02f77a8fdca78be1a01533b0e8f191512f}'" } ["order"]=> string(4) "DESC" }
And from the body is
{ "from": 0, "size": 10, "sort": [ { "_score": { "order": "desc" } } ], "query": { "bool": { "should": [ { "multi_match": { "query": "data", "type": "phrase", "fields": [ "post_title", "post_content", "post_excerpt", "terms.post_tag.name", "terms.category.name", "post_author.login" ], "boost": 4 } }, { "multi_match": { "query": "data", "fields": [ "post_title", "post_content", "post_excerpt", "terms.post_tag.name", "terms.category.name", "post_author.login" ], "boost": 2, "fuzziness": 0, "operator": "and" } }, { "multi_match": { "fields": [ "post_title", "post_content", "post_excerpt", "terms.post_tag.name", "terms.category.name", "post_author.login" ], "query": "data", "fuzziness": 1 } } ] } }, "post_filter": { "bool": { "must": [ { "bool": { "must": [ { "terms": { "terms.category.slug": [ "search-results" ] } } ] } }, { "terms": { "post_type.raw": [ "post", "page", "attachment", "subject", "author" ] } }, { "terms": { "post_status": [ "publish", "acf-disabled" ] } } ] } }, "aggs": { "terms": { "filter": { "bool": { "must": [ { "terms": { "post_type.raw": [ "post", "page", "attachment", "subject", "author" ] } }, { "terms": { "post_status": [ "publish", "acf-disabled" ] } } ] } }, "aggs": { "category": { "terms": { "size": 10000, "field": "terms.category.slug" } }, "post_tag": { "terms": { "size": 10000, "field": "terms.post_tag.slug" } }, "post_format": { "terms": { "size": 10000, "field": "terms.post_format.slug" } }, "author": { "terms": { "size": 10000, "field": "terms.author.slug" } }, "subject": { "terms": { "size": 10000, "field": "terms.subject.slug" } } } } } }
And the result is:
`{
"took": 13,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": [
]
},
"aggregations": {
"terms": {
"doc_count": 70,
"subject": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
]
},
"author": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
]
},
"post_format": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
]
},
"category": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "article",
"doc_count": 10
},
{
"key": "facts-about",
"doc_count": 7
},
{
"key": "events",
"doc_count": 2
},
{
"key": "publication",
"doc_count": 2
},
{
"key": "webinar",
"doc_count": 2
}
]
},
"post_tag": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "environment",
"doc_count": 7
},
{
"key": "monitoring",
"doc_count": 7
},
{
"key": "environmental",
"doc_count": 5
},
{
"key": "data",
"doc_count": 3
},
{
"key": "hydraulic-fill",
"doc_count": 3
},
{
"key": "planning",
"doc_count": 3
},
{
"key": "surveying",
"doc_count": 3
},
{
"key": "trailing-suction-hopper-dredgers",
"doc_count": 3
},
{
"key": "auger-dredgers",
"doc_count": 2
},
{
"key": "backhoe-dredgers",
"doc_count": 2
},
{
"key": "bathymetric",
"doc_count": 2
},
{
"key": "contracts",
"doc_count": 2
},
{
"key": "coral-reefs",
"doc_count": 2
},
{
"key": "cutter-suction-dredgers",
"doc_count": 2
},
{
"key": "dredging-equipment",
"doc_count": 2
},
{
"key": "drones",
"doc_count": 2
},
{
"key": "education",
"doc_count": 2
},
{
"key": "environmental-equipment",
"doc_count": 2
},
{
"key": "equipment",
"doc_count": 2
},
{
"key": "feedback-monitoring",
"doc_count": 2
},
{
"key": "geological",
"doc_count": 2
},
{
"key": "geotechnical",
"doc_count": 2
},
{
"key": "survey",
"doc_count": 2
},
{
"key": "systems-engineering",
"doc_count": 2
},
{
"key": "training",
"doc_count": 2
},
{
"key": "webinar",
"doc_count": 2
},
{
"key": "acoustic-doppler-current-profiler",
"doc_count": 1
},
{
"key": "adaptive-monitoring",
"doc_count": 1
},
{
"key": "adcp",
"doc_count": 1
},
{
"key": "aerial",
"doc_count": 1
},
{
"key": "auxiliary-equipment",
"doc_count": 1
},
{
"key": "baci",
"doc_count": 1
},
{
"key": "barges",
"doc_count": 1
},
{
"key": "bathymetric-survey",
"doc_count": 1
},
{
"key": "bed-material-characterisation",
"doc_count": 1
},
{
"key": "bidding",
"doc_count": 1
},
{
"key": "booster-stations",
"doc_count": 1
},
{
"key": "borrow-area",
"doc_count": 1
},
{
"key": "borrow-area-selection",
"doc_count": 1
},
{
"key": "bucket-ladder-dredgers",
"doc_count": 1
},
{
"key": "bucket-wheel-dredgers",
"doc_count": 1
},
{
"key": "building-with-nature",
"doc_count": 1
},
{
"key": "calculating",
"doc_count": 1
},
{
"key": "clay",
"doc_count": 1
},
{
"key": "climate",
"doc_count": 1
},
{
"key": "coastal",
"doc_count": 1
},
{
"key": "coastal-protection",
"doc_count": 1
},
{
"key": "compliance-monitoring",
"doc_count": 1
},
{
"key": "concept",
"doc_count": 1
},
{
"key": "contract",
"doc_count": 1
},
{
"key": "contractual-monitoring",
"doc_count": 1
},
{
"key": "conventions",
"doc_count": 1
},
{
"key": "coral",
"doc_count": 1
},
{
"key": "courses",
"doc_count": 1
},
{
"key": "database",
"doc_count": 1
},
{
"key": "design",
"doc_count": 1
},
{
"key": "dredger-register",
"doc_count": 1
},
{
"key": "dredging-projects",
"doc_count": 1
},
{
"key": "dredging-techniques",
"doc_count": 1
},
{
"key": "earthquakes",
"doc_count": 1
},
{
"key": "echo-sounding",
"doc_count": 1
},
{
"key": "eia",
"doc_count": 1
},
{
"key": "engineering",
"doc_count": 1
},
{
"key": "environmental-assessment",
"doc_count": 1
},
{
"key": "environmental-data",
"doc_count": 1
},
{
"key": "environmental-impact-assessment",
"doc_count": 1
},
{
"key": "environmental-management-plan",
"doc_count": 1
},
{
"key": "environmental-monitoring",
"doc_count": 1
},
{
"key": "fall-pipe-vessels",
"doc_count": 1
},
{
"key": "fleet-personnel",
"doc_count": 1
},
{
"key": "future",
"doc_count": 1
},
{
"key": "geological-data",
"doc_count": 1
},
{
"key": "geotechnical-data",
"doc_count": 1
},
{
"key": "gps",
"doc_count": 1
},
{
"key": "grab-or-clamshell-dredgers",
"doc_count": 1
},
{
"key": "hopper",
"doc_count": 1
},
{
"key": "hopper-load",
"doc_count": 1
},
{
"key": "hydraulic",
"doc_count": 1
},
{
"key": "hydraulic-data",
"doc_count": 1
},
{
"key": "hydrographic",
"doc_count": 1
},
{
"key": "investigation",
"doc_count": 1
},
{
"key": "jurong-island",
"doc_count": 1
},
{
"key": "land-reclamation",
"doc_count": 1
},
{
"key": "lidar",
"doc_count": 1
},
{
"key": "management",
"doc_count": 1
},
{
"key": "mangroves",
"doc_count": 1
},
{
"key": "monitoring-equipment",
"doc_count": 1
},
{
"key": "morphological",
"doc_count": 1
},
{
"key": "morphological-data",
"doc_count": 1
},
{
"key": "multi-beam",
"doc_count": 1
},
{
"key": "multicopters",
"doc_count": 1
},
{
"key": "nephelometric-turbidity-units",
"doc_count": 1
},
{
"key": "ntu",
"doc_count": 1
},
{
"key": "oceans",
"doc_count": 1
},
{
"key": "openearth",
"doc_count": 1
},
{
"key": "organisations",
"doc_count": 1
},
{
"key": "other-high-tech-dredging-equipment",
"doc_count": 1
},
{
"key": "personnel",
"doc_count": 1
},
{
"key": "preliminary-planning",
"doc_count": 1
},
{
"key": "projects",
"doc_count": 1
},
{
"key": "reefs",
"doc_count": 1
},
{
"key": "remediation",
"doc_count": 1
},
{
"key": "research",
"doc_count": 1
},
{
"key": "satellite",
"doc_count": 1
},
{
"key": "seminar",
"doc_count": 1
},
{
"key": "seminars",
"doc_count": 1
},
{
"key": "side-scan-survey",
"doc_count": 1
},
{
"key": "silt-screens",
"doc_count": 1
},
{
"key": "single-beam",
"doc_count": 1
},
{
"key": "site-investigation",
"doc_count": 1
},
{
"key": "site-investigations",
"doc_count": 1
},
{
"key": "soft-clays",
"doc_count": 1
},
{
"key": "soft-silts",
"doc_count": 1
},
{
"key": "sound",
"doc_count": 1
},
{
"key": "statistics",
"doc_count": 1
},
{
"key": "surveillance",
"doc_count": 1
},
{
"key": "surveyors",
"doc_count": 1
},
{
"key": "surveys",
"doc_count": 1
},
{
"key": "systems",
"doc_count": 1
},
{
"key": "techniques",
"doc_count": 1
},
{
"key": "tenders",
"doc_count": 1
},
{
"key": "total-suspended-solids",
"doc_count": 1
},
{
"key": "training-programmes",
"doc_count": 1
},
{
"key": "tss",
"doc_count": 1
},
{
"key": "tsunamis",
"doc_count": 1
},
{
"key": "turbidity",
"doc_count": 1
},
{
"key": "underwater",
"doc_count": 1
},
{
"key": "underwater-sound",
"doc_count": 1
},
{
"key": "water-injection-dredgers",
"doc_count": 1
},
{
"key": "webinars",
"doc_count": 1
},
{
"key": "workflow",
"doc_count": 1
}
]
}
}
}
}`
Hope you can help me!
Hi @FrieseNiels,
It looks like it's trying to return results for a category with the slug of search-results
.
Do you happen to know how that is getting set?
Now my results are getting inside the wp debugbar. Next step is getting them into my search results.
I used this query to load the results:
$queryArgs = array( 'ep_integrate' => true, 's' => get_search_query(), 'post_type' => 'any', 'suppress_filters' => TRUE, 'posts_per_page' => $per_page, 'page' => $page, 'offset' => $offset, 'max_num_pages' => 136, 'current_comment' => '-1', 'current_post' => '-1', 'sites' => 'all' );
Hi @FrieseNiels,
Per my previous question, the post_filter
is looking for posts in the search-results
term. Can you please confirm that there are posts in that term?
Hi @FrieseNiels,
I am closing this issue since we did not have a response from you.
Have you searched for similar issues before submitting this one? Yes I searched around all the open and closed issues.
Is this a bug, question or feature request? It's a question
Describe the issue you encountered: When I copy the request body from the WP Debug bar and paste it in my Kibana I get no results, but only when I remove post_filter from the request body I will get my results. How to solve this problem?
Current WordPress version: V4.9.5
Current ElasticPress version: V2.5.2
Current Elasticsearch version: V6.2.4
Where do you host your Elasticsearch server: On my own VPS
Other plugins installed (WooCommerce, Simple Redirect Manager, etc..): Not relevant to Elastic Search, maybe Advanced Custom Fields
Steps to reproduce: