Jump to content

Bug: Elastic 7.16 and activity stream with followed members


Martin A.
Go to solution Solved by Marc Stridgen,

Recommended Posts

Updated a forum to 4.6.9 yesterday, and at the same time updated Elastic to the highest supported version - 7.16.3.

Woke up to lots of these errors in the log caused by a stream periodically fetched as RSS.
 

   [error] => Array
        (
            [root_cause] => Array
                (
                    [0] => Array
                        (
                            [type] => x_content_parse_exception
                            [reason] => [1:8714] [bool] failed to parse field [should]
                        )

                )

            [type] => x_content_parse_exception
            [reason] => [1:8714] [bool] failed to parse field [filter]
            [caused_by] => Array
                (
                    [type] => x_content_parse_exception
                    [reason] => [1:8714] [bool] failed to parse field [should]
                    [caused_by] => Array
                        (
                            [type] => illegal_state_exception
                            [reason] => expected value but got [START_ARRAY]
                        )

                )

        )

The issue in the JSON appears to be here:

{
          "bool": {
            "should": [
              {
                "bool": {
                  "filter": [
                    {
                      "terms": {
                        "index_class": [
                          "IPS\\forums\\Topic\\Post"
                        ]
                      }
                    },
                    {
                      "terms": {
                        "index_item_id": [
                          657215,
                          ..........
                          785214
                        ]
                      }
                    }
                  ]
                }
              },
              [<--- HERE, this is 1:8714
                {
                  "terms": {
                    "index_author": [
                      61654,
                      151262,
                      204067,
                      204990,
                      272358,
                      503699,
                      554475
                    ]
                  }
                }
              ]
            ]
          }
        },

The latter "terms" should not have been in brackets.

This is caused by too many array()'s added to the condition in Elastic\Query.php

		/* Are we including content posted by followed members? */
		if ( $includeMembers and $followed = iterator_to_array( \IPS\Db::i()->select( 'follow_rel_id', 'core_follow', array( 'follow_app=? AND follow_area=? AND follow_member_id=?', 'core', 'member', $this->member->member_id ), 'follow_rel_id asc' ) ) )
		{
			$conditions[] = array(
				array(
					'terms'	=> array( 'index_author' =>  $followed )
				)
			);			
		}

I've removed one of those arrays and that seems to have solved the issue.

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...