2017-02-05 4 views
0

自動補完サポートでインデックスを作成しようとしていますが、データを追加できません。 私はこれを手伝ってください、私は最後の48hrsからこのエラーに立ち往生しました。Mapper解析例外ルートマッピング定義にサポートされていないパラメータがあります

設定については添付ファイルをご覧ください

PUT http://localhost:9200/my_index/_mapping/users/ 入力:

{ 
    "userId": "2", 
    "userFirstName": "m4", 
    "userLastName": "m4", 
    "userMobile": "4047534441", 
    "userEmail": "[email protected]", 
    "userSpecialization": "1:3", 
    "userCityId": "6", 
    "userCityName":"Hyderabad" 
} 

Outout:

{ "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [userId : 2] [userFirstName : m4] [userLastName : m4] [userMobile : 40475341] [userEmail : [email protected]] [userSpecialization : 1:3] [userCityId : 6] [userCityName : Hyderabad]" } ], "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [userId : 2] [userFirstName : m4] [userLastName : m4] [userMobile : 40475341] [userEmail : [email protected]] [userSpecialization : 1:3] [userCityId : 6] [userCityName : Hyderabad]" }, "status": 400 } 

セッティング:

{ 
    "my_index": { 
    "aliases": { 

    }, 
    "mappings": { 
     "practices": { 
     "_all": { 
      "analyzer": "nGram_analyzer", 
      "search_analyzer": "whitespace_analyzer" 
     }, 
     "properties": { 
      "practiceCity": { 
      "type": "string", 
      "index":"analyzed" 
      }, 
      "practiceId": { 
      "type": "long", 
      "index":"not_analyzed" 
      }, 
      "practiceName": { 
      "type": "string", 
      "boost": 10, 
      "index":"analyzed" 
      }, 
      "practicePhone": { 
      "type": "long", 
      "boost": 10, 
      "index":"analyzed" 
      }, 
      "practiceService": { 
      "type": "string", 
      "boost": 5, 
      "index":"not_analyzed" 
      } 
     } 
     }, 
     "users": { 
     "_all": { 
      "analyzer": "nGram_analyzer", 
      "search_analyzer": "whitespace_analyzer" 
     }, 
     "properties": { 
      "userCityId": { 
      "type": "long", 
      "index":"not_analyzed" 
      }, 
      "userCityName": { 
      "type": "string", 
      "index":"not_analyzed" 
      }, 
      "userEmail": { 
      "type": "string", 
      "index":"analyzed" 
      }, 
      "userFirstName": { 
      "type": "string", 
      "boost": 10, 
      "index":"analyzed" 
      }, 
      "userId": { 
      "type": "long" 
      }, 
      "userLastName": { 
      "type": "string", 
      "boost": 10, 
      "index":"not_analyzed" 
      }, 
      "userMobile": { 
      "type": "string", 
      "index":"analyzed" 
      }, 
      "userSpecialization": { 
      "type": "string", 
      "boost": 5, 
      "index":"not_analyzed" 
      } 
     } 
     } 
    }, 
    "settings": { 
     "index": { 
     "analysis": { 
      "filter": { 
      "nGram_filter": { 
       "max_gram": "20", 
       "type": "nGram", 
       "min_gram": "3", 
       "token_chars": [ 
       "letter", 
       "digit", 
       "punctuation", 
       "symbol" 
       ] 
      } 
      }, 
      "analyzer": { 
      "nGram_analyzer": { 
       "type": "custom", 
       "filter": [ 
       "lowercase", 
       "asciifolding", 
       "nGram_filter" 
       ], 
       "tokenizer": "whitespace" 
      }, 
      "whitespace_analyzer": { 
       "type": "custom", 
       "filter": [ 
       "lowercase", 
       "asciifolding" 
       ], 
       "tokenizer": "whitespace" 
      } 
      } 
     }, 
     "number_of_replicas": "1", 
     "number_of_shards": "5" 
     } 
    } 
    } 
} 

答えて

1

新しい文書のインデックスに使用しているURLが間違っています。 _mappingエンドポイントは、ドキュメントのインデックス作成ではなくマッピングタイプを管理するためのエンドポイントです。

これを代わりに使用すればうまくいくはずです。

PUT http://localhost:9200/my_index/users/2 
{ 
    "userId": "2", 
    "userFirstName": "m4", 
    "userLastName": "m4", 
    "userMobile": "4047534441", 
    "userEmail": "[email protected]", 
    "userSpecialization": "1:3", 
    "userCityId": "6", 
    "userCityName":"Hyderabad" 
} 
+0

私は同じことを考えていましたが、同じURLパターンを試してみましたが、次のエラーが発生しました。 PUTはhttp:// localhostを: ませハンドラは、[/ gotomedic /ユーザー/]および方法[PUT]私はそれがURL HTTPを期待している知っているようになったデバッグ後 URIが見つかりません9200/my_index /ユーザー:// localhost:9200/my_index/users/、その時点で私は自分のDBに格納していないためelastic_document_idを持っていません。 投稿を使用すると、リクエストは正常に応答しますが、別の重複レコードで終了します。 –

+0

はい、PUTを使用するとIDを指定する必要があります。そうしないとPOSTが自動的に生成されます。 'userId'フィールドをidとして使うことができます。おそらくユニークなのでしょうか? 'PUT http:// localhost:9200/my_index/users/2' – Val

+0

いいえ、それはレコードを特定しませんが、私は次の方法で試しました。 PUT http:// localhost:9200/gotomedic/users/_search?q = userId:8ただし、新しい重複レコードが作成されています。 あなたが1つを提案した方法 PUT http:// localhost:9200/my_index/users/2はelastic_document_id = user_idの時にしか動作しません。どのようにして作成するのか分かりません。私の設定にいくつかの変更を加えるための解決策を知ってください。 –

関連する問題