I have the following setup:

 indexes:
        website:
            client: default
            finder: ~
            settings:
                index:
                    analysis:
                        analyzer:
                            my_analyzer:
                                type: custom
                                tokenizer: lowercase
                                filter   : [my_ngram]
                        filter:
                            my_ngram:
                                type: "edgeNGram"
                                min_gram: 2
                                max_gram: 5
            types:
                shop:
                    mappings:
                        username: { boost: 3 }
                        fullname: { boost: 2 }
                        bio: { boost: 1 }
                        userPictures:
                            type: "nested"
                            properties:
                                caption: { boost: 5 }
                    persistence:
                        driver: orm 
                        model: App\MainBundle\Entity\InstagramShop
                        provider: ~
                        listener: ~


and here's my nested query in PHP:


                $finder = 
$this->container->get('fos_elastica.finder.website');

                $mainQuery = new \Elastica\Query\Bool();
                $shopQuery = new \Elastica\Query\QueryString();
                $shopQuery->setParam('query', $searchquery);
                $shopQuery->setParam('fields', array(
                    'username', 'bio', 'fullname'
                ));

                $pictureQuery = new \Elastica\Query\QueryString();
                $pictureQuery->setParam('query', $searchquery);
                $pictureQuery->setParam('fields', array(
                    'caption'
                ));

                $nestedQuery = new \Elastica\Query\Nested();
                $nestedQuery->setPath('userPictures');
                $nestedQuery->setQuery($pictureQuery);

                $mainQuery->addShould($shopQuery);
                $mainQuery->addShould($nestedQuery);

                $items = $finder->find($mainQuery);

I wonder why this only matches with the shopQuery and not with the 
nestedQuery. Here's the structure for the InstagramShop class:

class InstagramShop
{

    /**
     * @Exclude()
     * @ORM\OneToMany(targetEntity="InstagramShopPicture", mappedBy="shop", 
cascade={"persist"})
     * @ORM\OrderBy({"created" = "DESC"})
     */
    protected $userPictures;

    /**
     * Get attributes
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getUserpictures()
    {
        return $this->userPictures;
    }
}

User pictures here is a collection of InstagramShopPicture which has a 
caption of type string

Any idea why it can't find userPictures caption?

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/9277d215-7feb-4087-a08b-ef7b8a4d9ca9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to