# インデックス、マッピング定義の作成エラー

**URL:** https://discuss.elastic.co/t/topic/256987
**Category:** 日本語による質問・議論はこちら
**Created:** [November 29, 2020, 2:09pm UTC](https://discuss.elastic.co/t/topic/256987 "2020-11-29T14:09:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![miya2](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@miya2](https://discuss.elastic.co/u/miya2)
#### Post date: [November 29, 2020, 2:09pm UTC](https://discuss.elastic.co/t/topic/256987/1 "2020-11-29T14:09:49Z")

</div>

以下のマッピング定義を使用したインデックスの作成で  
エラーが発生しており色々調べてはいるのですが解決せず、  
回答頂けますと幸いです。  
ElasticsearchのVersion7.5.0を使用しています。

・mapping.json

```auto
{
    "mappings" : {
        "text" : {
            "properties" : {
                "text1" : { "type" : "text", "fielddata" : "true" },
                "text2" : { "type" : "text", "fielddata" : "true" }
            }
        }
    }
}

```

・作成コマンド

```auto
curl -H "Content-Type: application/json" -XPUT 'http://localhost:9200/test?pretty' -d @mapping.json

```

・エラー内容

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "Root mapping definition has unsupported parameters: [text : {properties={text1={type=text}, text2={type=text}}}]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [text : {properties={text1={type=text}, text2={type=text}}}]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "Root mapping definition has unsupported parameters: [text : {properties={text1={type=text}, text2={type=text}}}]"
    }
  },
  "status" : 400
}

```

---

<div class="post-metadata">

### Author: ![tsgkdt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsgkdt/32/39151_2.png) [@tsgkdt](https://discuss.elastic.co/u/tsgkdt)
#### Post date: [November 30, 2020, 3:06am UTC](https://discuss.elastic.co/t/topic/256987/2 "2020-11-30T03:06:20Z")

</div>

意図しているドキュメントの構造は以下のようなものでしょうか。

```auto
{
  "text": {
    "text1": "aaaaa",
    "text2": "bbbbb"
  }
}

```

であれば、次のようなjsonでいかがでしょうか。mappingsとtextの間にpropertiesをおきました。

```json
{
  "mappings": {
    "properties": {
      "text": {
        "properties": {
          "text1": {
            "type": "text",
            "fielddata": "true"
          },
          "text2": {
            "type": "text",
            "fielddata": "true"
          }
        }
      }
    }
  }
}

```

ご参考になれば幸いです。

---

<div class="post-metadata">

### Author: ![miya2](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@miya2](https://discuss.elastic.co/u/miya2)
#### Post date: [December 1, 2020, 1:04am UTC](https://discuss.elastic.co/t/topic/256987/3 "2020-12-01T01:04:20Z")

</div>

ご回答ありがとうございます。  
頂いたjsonで作成することができました。  
ありがとうございました。

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 29, 2020, 1:04am UTC](https://discuss.elastic.co/t/topic/256987/4 "2020-12-29T01:04:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
