0

I am fetching documents from elasticsearch using queries. First I am bringing Oracle records using logstash JDBC input plugin to elasticsearch. After that I am adding mappings to the index. After the mappings I am trying to fetch documents using queries, it's not display any results from the queries.

Please find my mappings below :

PUT /documents_test4{
  "settings" : {
    "analysis" : {
      "filter" : {
        "ngram_filter" : {
          "type" : "ngram",
          "min_ngram" : 2,
          "max_ngram" : 4,
        }
      },
    "analyzer" : {
      "ngram_analyzer" : {
        "type" : "custom",
        "tokenizer" : "standard",
        "filter" : [
             "lowercase",
             "ngram_filter"
          ]
      }
    }
  }
},

"mappings" : {
  "documents_test4" : {
    "_all" : {
      "type" : "string",
      "analyzer" : "ngram_analyzer"
    },
    "properties" : {
      "filename" : {
        "type" : "string",
        "include_in_all" : true,
        "analyzer" : "ngram_analyzer"
      }
    }
  }
}

Please find the below query that am using to fetch documents from elasticsearch

GET documents_test4/_search
{
  "query" : {
    "match" : {
      "filename":"Karthikeyan"
    }
  }
}

Am getting the below response from elasticsearch

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": null,
    "hits": []
  }
}

Also,I am getting below syntax error for both mapping & query request also.

expected one of get/post/put/delete/head syntax error 
Green
  • 2,405
  • 3
  • 22
  • 46
Karthikeyan
  • 1,927
  • 6
  • 44
  • 109
  • 1
    https://stackoverflow.com/questions/9421358/filename-search-with-elasticsearch check the first answer – Green Jun 11 '18 at 09:26
  • @Green its very useful and it solved my problem. thanks for your suggestions. do you have any idea for tokenizer pattern for alphanumeric with specialcharacters https://stackoverflow.com/questions/50808974/elasticsearch-mapping-analyzer-with-alphanumeric-special-characters-pattern – Karthikeyan Jun 12 '18 at 03:57

0 Answers0