Featured post

Logging in ASP.NET Core 3.1 Using NLog

Image
  NLog          NLog is an open source logging framework that provides a great flexibility and configurable options to log the insights of your application. It allows to select multiple targets like database, files, console, etc. at the same time so that user don’t have to maintain different configurations in code. This is the most widely used logging framework out there.  For more details :  https://nlog-project.org/    It is easy to implement in your Asp.Net core application. We'll see step by step with image.    1.     Open Visual Studio and Create new project 2.    Choose ASP.Net Core Web Application 3. Enter Name of project 4.  Choose Web Application  5.  Right Click on your project name and choose Manage Nudget packages.         Search these two nudget packages and install.            1. NLog.Config         2. NLog.Web.AspNetCore                   6.  Open Nlog.config file and paste the code.   <?xml version= "1.0" encoding= "utf-8" ?> < nlog

Indexing and Searching Elasticsearch 6.3.1 | 2020

 




1. Download Elasticsearch 6.3.1 from link below


2. Download Kibana 6.3.1 from link below 



3. for start elastic in your pc double click on elasticsearch.bat 
  -  Go your download destination where you download elastic zip file and extract zip
  -  Go to bin folder there is bat file


4. for start kibana in your pc double click on kibana.bat
  -  Go your download destination where you download kibana zip file and extract zip
  -  Go to bin folder there is bat file


5. Open browser and type
   - http://localhost:9200   for elasticsearch
   - http://localhost:5601   for kibana dashboard


6. Go to kibana  dashboard and go to dev tools


7. In dev console you can create index,add docs and searching.


8. Check the Code below

// Create Index
PUT test
{
  "settings": {
    "blocks.read_only": false,
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter":
["lowercase"]
         }
       }
     }
   },
  "mappings": {
    "properties": {
        "username":{
              "type":"text",
              "analyzer":"my_analyzer"
         },
        "password":{
              "type":"text",
              "analyzer":"my_analyzer"
         },
        "city":{
              "type":"text",
              "analyzer":"my_analyzer"
        }
      }
    }
 }

// Add Doc
POST test/_doc
{
    "username": "john",
    "password":"123",
    "city":"California"
}


// Searching

GET  test/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
              "query": "john",
               "fields": ["username","password","city"]
            }
        }
      ]
    }
  }



Comments

Popular posts from this blog

Hello World Program

Logging in ASP.NET Core 3.1 Using NLog

What is JVM, JDK and JRE