Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error querying Elasticsearch: Unknown key for a START_OBJECT in [filter] #102

Open
danielbachhuber opened this issue Sep 28, 2018 · 5 comments

Comments

@danielbachhuber
Copy link

Using docker.elastic.co/elasticsearch/elasticsearch:5.5.3, I see this error in $es_response:

  'error' => 
  array (
    'root_cause' => 
    array (
      0 => 
      array (
        'type' => 'parsing_exception',
        'reason' => 'Unknown key for a START_OBJECT in [filter].',
        'line' => 1,
        'col' => 11,
      ),
    ),
    'type' => 'parsing_exception',
    'reason' => 'Unknown key for a START_OBJECT in [filter].',
    'line' => 1,
    'col' => 11,
  ),
  'status' => 400,
)

According to a quick Google search, the DSL changed in ES 5.1: https://stackoverflow.com/questions/40996266/elasticsearch-5-unknown-key-for-a-start-object-in-filters

Is SearchPress compatible with Elasticsearch 5.5.3? Any other debugging I can do?

@mboynes
Copy link
Contributor

mboynes commented Sep 28, 2018

SearchPress is compatible with ES 5.x (and every other version, incidentally). Where did the problem query originate, was it from SearchPress' core search replacement, another plugin like ES_WP_Query, or was the query custom?

@danielbachhuber
Copy link
Author

Where did the problem query originate, was it from SearchPress' core search replacement, another plugin like ES_WP_Query, or was the query custom?

I'm using es-wp-query with es_wp_query_load_adapter( 'searchpress' );:

add_action( 'after_setup_theme', function() {
	if ( ! defined( 'PMC_SITE_NAME' ) || 'bgr' !== PMC_SITE_NAME ) {
		return;
	}
	require_once dirname( dirname( __file__ ) ) . '/themes/vip/plugins/es-wp-query-0.2.0/es-wp-query.php';
	es_wp_query_load_adapter( 'searchpress' );
} );

The original WP_Query is this: https://gist.github.com/danielbachhuber/5ce6aa612c428c89297d9f5251a7e1cc

@mboynes
Copy link
Contributor

mboynes commented Sep 28, 2018

Can you confirm that’s loading the latest version of ES_WP_Query?

@danielbachhuber
Copy link
Author

danielbachhuber commented Sep 28, 2018

And here's the es_posts_selection:

[28-Sep-2018 12:59:18 UTC] array (
  'filter' => 
  array (
    'and' => 
    array (
      0 => 
      array (
        'terms' => 
        array (
          'post_id' => 
          array (
            0 => 5021352,
            1 => 5021356,
            2 => 5021354,
            3 => 5021358,
            4 => 5021352,
          ),
        ),
      ),
      1 => 
      array (
        'term' => 
        array (
          'post_type.raw' => 'post',
        ),
      ),
      2 => 
      array (
        'terms' => 
        array (
          'post_status' => 
          array (
            0 => 'publish',
          ),
        ),
      ),
    ),
  ),
  'query' => 
  array (
  ),
  'sort' => 
  array (
  ),
  'fields' => 
  array (
    0 => 'post_id',
  ),
  'size' => 5,
  'from' => 0,
)

Can you confirm that’s loading the latest version of ES_WP_Query?

local ➜  es-wp-query-0.2.0 git:(master) ✗ svn up
Updating '.':
At revision 353924.

@danielbachhuber
Copy link
Author

Can you confirm that’s loading the latest version of ES_WP_Query?

Ah, this might be the issue. I'm using the version of es-wp-query in the VIP plugins repo. Maybe it hasn't been updated to work with Elasticsearch 5.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants