Join Chander Dhall for an in-depth discussion in this video Import JSON data, part of Azure Search for Developers.
- [Lecturer] Before we create an index I would like to point a location to get some data, that will be very helpful. So you can go to elastic.co/guide/en/kibana/current /tutorial-load-dataset.html and then look for accounts.zip, and you can click Show in folder and then right-click and Extract All.
Right-click and say Edit with Notepad++ or any editor of your choice. So, as you can see we've got the file. Now, the reason I chose this file is because we have a very small dataset and it gets us every single thing we need. Now, one thing you can see is that we also have CRLF here and we also have index. Now, we don't need line number one, three, and pretty much all the odd line numbers, so we can work with this data once we get to Visual Studio.
So I'm going to close this and copy the file. We're going to go to Visual Studio, say New, Project, we can choose anything, I'm going to go ahead and use a console application just to make things simple and then call it Cazton, which is the name of my company and say OK. I can right-click the project and say open file in folder and then paste the file that I had, which is accounts.json, close it, refresh this thing, and if it doesn't show up make sure Show All Files option is clicked and then right-click on it to Include in Project.
You should also right-click on it, go to the Properties, make sure this is Copy if newer just in case we need to use this as a resource. Now that we have accounts.json we're going to work with this data a little bit. So, what I like to do is copy this, Control + Shift + F and paste it right here, and now, number one is what changes? This is the variable, that's where I need to introduce our regular expression, I'm going to say \d and say star, make sure that this option is checked and then look in this document, we don't want this to happen in the entire solution.
And now say Replace in Files. Before we start replacing make sure we can do Find Next, and, as you can see, it's picking all the lines we want to remove. So now say Replace All. 1,000 occurrences replaced, that's okay, that's great. Now next thing to keep in mind is that we still have these empty lines and we're going to go \n\r and then start replacing it and we can do Replace All.
So you can see we are able to get rid of every single line like that and that's the data we want. Now that we have this data we want to make sure that we can send this data over to Azure Search and the way we do that is by creating an index, in this case we can create accounts index that will be part of the Azure Search instance.
Looking for study partners?Join the AZ-203 Azure Exam study group
Discover how to equip your iOS app with advanced search features—including auto-complete functionality—by leveraging the power of Azure Search. This course covers CRUD operations, importing JSON data, searching via APIs, and creating a search service. Learn how to query indexes, Join Chander Dhall as he takes you through development steps that include working with boosting, suggestors, facets, and synonyms.
- Querying and indexing
- Creating a search service
- Using APIs during searching
- Importing JSON data
- Handling synonyms
- Working with suggestors and facets