2017-11-26 13 views
0

json.gz wikipediaダンプをelasticsearchにインポートするには、例のオンラインに従います:https://www.elastic.co/blog/loading-wikipediawikipedia json.gzをelasticsearchに一括アップロードできません

curl -s 'https://'$site'/w/api.php?action=cirrus-mapping-dump&format=json&formatversion=2' | 
jq .content | 
sed 's/"index_analyzer"/"analyzer"/' | 
sed 's/"position_offset_gap"/"position_increment_gap"/' | 
curl -XPUT $es/$index/_mapping/page?pretty -d @- 

を実行した後、私はエラーを取得する:

{ 
    "error" : { 
    "root_cause" : [ 
     { 
     "type" : "mapper_parsing_exception", 
     "reason" : "Unknown Similarity type [arrays] for field [category]" 
     } 
    ], 
    "type" : "mapper_parsing_exception", 
    "reason" : "Unknown Similarity type [arrays] for field [category]" 
    }, 
    "status" : 400 
} 

誰もが任意のアイデアを得ましたか。私は説明された方法を使用してウィキペディアのコンテンツを取り込むことができません。少なくともチュートリアルのページを更新してもらいたいと願っています。

答えて

0

uriを見ると、変数formatversion=2は、マッピングが弾性2.xに基づいていることを示しています。

  • プロダクションのelasticsearchインデックスを手動でダウンロードしてください。 http://dumps.wikimedia.org/other/cirrussearch/current/

  • 必要に応じてマッピングを作成し、elastic 5.xで廃止予定の機能を変更します。

    { 
    "mappings": { 
    "page": { 
        "properties": { 
         "auxiliary_text": { 
         "type": "text" 
        }, 
        "category": { 
         "type": "text" 
        }, 
        "coordinates": { 
         "properties": { 
         "coord": { 
          "properties": { 
           "lat": { 
            "type": "double" 
           }, 
           "lon": { 
            "type": "double" 
           } 
          } 
         }, 
         "country": { 
          "type": "text" 
         }, 
         "dim": { 
          "type": "long" 
         }, 
         "globe": { 
          "type": "text" 
         }, 
         "name": { 
          "type": "text" 
         }, 
         "primary": { 
          "type": "boolean" 
         }, 
         "region": { 
          "type": "text" 
         }, 
         "type": { 
          "type": "text" 
         } 
         } 
        }, 
        "defaultsort": { 
         "type": "boolean" 
        }, 
        "external_link": { 
         "type": "text" 
        }, 
        "heading": { 
         "type": "text" 
        }, 
        "incoming_links": { 
         "type": "long" 
        }, 
        "language": { 
         "type": "text" 
        }, 
        "namespace": { 
         "type": "long" 
        }, 
        "namespace_text": { 
         "type": "text" 
        }, 
        "opening_text": { 
         "type": "text" 
        }, 
        "outgoing_link": { 
         "type": "text" 
        }, 
        "popularity_score": { 
         "type": "double" 
        }, 
        "redirect": { 
         "properties": { 
         "namespace": { 
          "type": "long" 
         }, 
         "title": { 
          "type": "text" 
         } 
         } 
        }, 
        "score": { 
         "type": "double" 
        }, 
        "source_text": { 
         "type": "text" 
        }, 
        "template": { 
         "type": "text" 
        }, 
        "text": { 
         "type": "text" 
        }, 
        "text_bytes": { 
         "type": "long" 
        }, 
        "timestamp": { 
         "type": "date", 
         "format": "strict_date_optional_time||epoch_millis" 
        }, 
        "title": { 
         "type": "text" 
        }, 
        "version": { 
         "type": "long" 
        }, 
        "version_type": { 
         "type": "text" 
        }, 
        "wiki": { 
         "type": "text" 
        }, 
        "wikibase_item": { 
         "type": "text" 
         } 
        } 
    } 
    } 
    } 
    
  • あなたは、インデックスを作成した後 - この例ではenwiki - あなただけ入力します:たとえば

    zcat enwiki-current-cirrussearch-general.json.gz | parallel --pipe -L 2 -N 2000 -j3 'curl -s http://localhost:9200/enwiki/_bulk --data-binary @- > /dev/null'

関連する問題