What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Can someone please tell me can I see the JSON object for elastic search on frontend?

U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

Can someone please tell me can I see the JSON object for elastic search on frontend?

Comments

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet

    \Spryker\Client\Catalog\CatalogClient::catalogSearch

    after expanding SearchQuery add:

    // dump query as json/** @var Query $query */
    $query = $searchQuery->getSearchQuery();
    $json = json_encode($query->toArray());
    dd($json);
    

    as a tmp. workaround

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    @UNGMX0012 Thanks. Could be a silly question but can you please tell me how to trigger this if I set a debug breakpoint here?

  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 🧑🏻‍🚀 - Cadet

    set a breakpoint here and use json_encode($searchQuery->getSearchQuery()->toArray())
    I usually copy&paste the json output into a JSON scratch file in phpstorm and do “reformat code” for pretty print. In your case it might be good to use kibana to manually check your search query.

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    Thanks @UNGMX0012