How to use an Array mapping in ES?

后端 未结 1 823
长发绾君心
长发绾君心 2021-02-01 13:15

I wanted to create a mapping for movies that look like:

{
   title: \"The Artist\",
   genres: [\"Drama\", \"Comedy\"]
}

In the El

1条回答
  •  滥情空心
    2021-02-01 13:48

    So ElasticSearch doesn't need to specify that a mapping is an array. You can treat any mapping as an array by using square brackets:

    {
        title: ["The Artist", "Formerly known as Prince" ],
        genres: ["Drama", "Comedy"],
        ...
    }
    

    See the last sentence on the page:

    We could, of course, name the field as tag and skip the index_name all together

    The "index_name" mapping just allows you to define an alias in the plural form of tag -> tags.

    0 讨论(0)
提交回复
热议问题