My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Data Visualizer to upload a text file into Elasticsearch

escoder's photo
escoder
·Jun 12, 2021·

2 min read

The File data visualizer feature lets you upload a CSV, JSON, or text file. This feature enables you to ingest, parse, and index your file with a few clicks. It was introduced in elasticsearch version 6.5. The below step-by-step procedure will give you a clear understanding of how to use the File data visualizer.

  1. The File Data Visualizer feature is found in Kibana under the Machine Learning > Data Visualizer section. Then click on the "Upload a file" option. 1.png
  2. Navigate to the respective directory, and then select the file which you want to upload. 2.png
  3. Once the file is selected, it will give you the file content of the first 1000 lines along with a summary. You can also use the "Override settings button" to override some of the default settings like column name, field name, data format, etc. 3.png
  4. After making all the required changes, the next step is to import the data 4.png

Append a new field in the documents using ingest pipeline

  1. Follow steps 1-2 again. 5.png
  2. Now, when you are creating a new index there is an "Advanced" option. Click on that. You will see there are Index settings, mappings, and the ingest pipeline. By default index settings is empty (As no additional settings are set currently), index mapping is the default mapping that is created based on the data that is being indexed, and the ingest pipeline is also the default one. 6.png
  3. Main task here is to add a new additional field in the data, let's say the field name is info which will contain the value of both the field Country name and Positive affect. For this, you need to add this field name in the index mapping and use the append processor in the ingest pipeline to include this field with the correct value in all the documents of this index. 7.png
  4. After all the configuration is done, just click on the import button and click on "view index in discover" 8.png
  5. You can see that the new field value is indexed in each document of the index. 9.png