簡體   English   中英

文檔類中的ONGR ElasticSearchBundle映射

[英]ONGR ElasticSearchBundle Mapping in Document Class

我在我的Symfony項目中安裝了ONGR ElasticSearchBundle。 要搜索具有公司名稱和描述的索引,索引名稱是公司。 它看起來像這樣:

 "mappings": {
        "_doc": {
            "properties": {
                "id": {"type": "long"},
                "entityid": {"type": "long"},
                "entityname": {"type": "keyword"},
                "name": {"type": "text"},
                "street": {"type": "text"},
                "city": {"type": "text"},
                "zip": {"type": "long"},
                "ziptext": {"type": "keyword"},
                "regionisocode": {"type": "keyword"},
                "desc": {"type": "text"},
                "branch": {"type": "text"},
                "branchid": {"type": "long"},
                "foundingyear": {"type": "date"}

            }
        }
    }

然后我使用控制台工具創建一個文檔。

/**
 * Company
 *
 * @ES\Document()
 */
class Company
{
    /**
     * @var string
     *
     * @ES\Property(type="long", options={"index"="not_analyzed"})
     */
    private $id;

    /**
     * @var string
     *
     * @ES\Property(type="long", options={"index"="not_analyzed"})
     */
    private $entityid;

    /**
     * @var string
     *
     * @ES\Property(type="keyword", options={"index"="not_analyzed"})
     */
    private $entityname;
...

到目前為止,這似乎有效。 與ElasicSearch主機的連接正常,但即使我做了一個MatchAllQuery()我認為這是一個映射問題,我也沒有得到搜索結果? 梅比有人有提示嗎?

誠摯

對您正在使用的工具(ES旁邊)沒有任何經驗,但您實際上是否已編入索引/插入任何文檔?

如果您在本地運行ES,請嘗試: localhost:9200/companies/_search以驗證是否有任何文檔以及是否實際創建了索引。

你按照這些步驟了嗎? 您還可以在此處找到有關索引數據的更多信息。

快樂的編碼! :d

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM