Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this mapping and settings:

PUT loalhost:9200/persondb
{
    "settings": {
        "analysis": {
            "filter": {
                "autocomplete_filter": { 
                    "type": "edge_ngram",
                    "min_gram": 2,
                    "max_gram": 15
                }
            },
            "analyzer": {
                "autocomplete": {
                    "type": "custom",
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "autocomplete_filter" 
                    ]
                },
                "rock_field":{
		    "type": "custom",
                    "tokenizer": "whitespace",
                    "filter": "lowercase"
                }
            }
        }
    }
}


PUT localhost:9200/persondb/userData/_mapping
{
    "userData": {
        "properties": {
            "FirstName": {
                "type":            "string",
                "index_analyzer":  "autocomplete", 
                "search_analyzer": "rock_field" 
            },
			"LastName": {
                "type":            "string",
                "index_analyzer":  "autocomplete", 
                "search_analyzer": "rock_field" 
            },
			"CurrentCompany": {
				"type": "string",
				"analyzer": "rock_field"
			},
			"CurrentLocation": {
				"properties": {
					"City": {
						"type": "string",
						"analyzer": "rock_field"
					},
					"Country": {
						"type": "string",
						"analyzer": "rock_field"
					},
					"State": {
						"type": "string",
						"analyzer": "rock_field"
					}
				}
			},
			"ProfileTitle": {
				"type": "string",
				"analyzer": "rock_field"
			}
        }
    }
}


http://localhost:9200/user/search passing this query string = {"q":"san"}

When I run this query from POSTMAN am getting this results with only 2 elements

[
  {
    "Id": "57236cbe80eed110c8b739f5",
    "Score": 0.7097881
  },
  {
    "Id": "5739d95d80eed7100c32a59d",
    "Score": 0.48913243
  },
  {
    "Id": "57332dec80eed60a0492b68e",
    "Score": 0.3120335
  },
..
.....


]


Why am I not getting all the data elements in the elasticsearch db
as in the mapping?
thanks for your help.

What I have tried:

localhost:9200/persondb/_search
when I run this query It returns the 10 hits with all the data elements>

{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 602,
    "max_score": 1,
    "hits": [
      {
        "_index": "persondb",
        "_type": "userData",
        "_id": "567855bcd5eae9184c833993",
        "_score": 1,
        "_source": {
          "FirstName": "Kishore",
          "LastName": "Rajendra",
          "ProfileTitle": "default",
          "CurrentLocation": {
            "Country": "India",
            "ZipCode": null,
            "State": "Karnataka",
            "City": "Bangalore",
            "Region": null,
            "Verified": false
          },
          "CurrentCompany": "Rock LLC",
          "Project": [
.
.
.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900