A carregar o 'Dump' do Wikipédia na pesquisa elastica

quero carregar um 'dump' do Wikipédia em XML como: http://ftp.acc.umu.se/mirror/wikimedia.org/dumps/enwiki/20171001/enwiki-20171001-pages-articles.xml.bz2 para a pesquisa elastica (5.6.4). No entanto, todas as ferramentas e tutoriais que encontrei estão desatualizados e não são compatíveis com a minha versão Elasticsearch. Alguém pode explicar qual é a melhor maneira de importar o lixo para a busca elastica?

Author: Schroder22, 2017-11-24

1 answers

Há dois anos, a wikimedia disponibilizou depósitos dos índices de pesquisa elastica da produção. Os índices são exportados todas as semanas e para cada wiki existem duas exportações.
The content index, which contains only article pages, called content;
The general index, containing all pages. This includes talk pages, templates, etc, called general;
Pode encontrá-los aqui. http://dumps.wikimedia.org/other/cirrussearch/current/
  • Cria um mapeamento de acordo com as tuas necessidades. Por exemplo:
    {
         "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"
               }
            }
         }
      }
    

    }

Uma vez criado o índice, basta digitar:

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'
Divirtam-se!
 2
Author: Lupanoide, 2017-11-24 15:32:57