我正在尝试使用空格进行通配符查询.它很容易在期限基础上匹配,但不能在现场基础上匹配.
我已经阅读了文档,其中说我需要将字段设置为not_analyzed但是使用此类型集,它不会返回任何内容.
这是它在期限基础上的映射:
{
"denshop" : {
"mappings" : {
"products" : {
"properties" : {
"code" : {
"type" : "string"
},
"id" : {
"type" : "long"
},
"name" : {
"type" : "string"
},
"price" : {
"type" : "long"
},
"url" : {
"type" : "string"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是完全相同的查询不返回任何内容的映射:
{
"denshop" : {
"mappings" : {
"products" : {
"properties" : {
"code" : {
"type" : "string"
},
"id" : { …Run Code Online (Sandbox Code Playgroud) 我试图将嵌套文档显示为默认值,这意味着当我查询 api 时,它应该返回文档及其关系。
我的两个实体:
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Traits\TimestampableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ApiResource()
* @ORM\Entity(repositoryClass="App\Repository\ClaimRepository")
* @ORM\Table("claims")
*/
class Claim
{
use TimestampableTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Activity", mappedBy="claim", cascade={"persist", "remove"})
*/
private $activities;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\ClaimState", inversedBy="claims", cascade={"persist", "remove"})
* @ORM\OrderBy({"id" = "desc"})
*/
private $states;
Run Code Online (Sandbox Code Playgroud)
而另一个:
<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Traits\TimestampableTrait;
use …Run Code Online (Sandbox Code Playgroud)