Skip to content

Instantly share code, notes, and snippets.

@BowlingX
Created December 13, 2011 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BowlingX/424ce0205a9a16e7afe1 to your computer and use it in GitHub Desktop.
Save BowlingX/424ce0205a9a16e7afe1 to your computer and use it in GitHub Desktop.
Geonames.org Meta Settings and Mapping
{
state: open
settings: {
index.analysis.filter.name_ngrams.type: edgeNGram
index.number_of_replicas: 1
index.analysis.filter.snowball_de.language: German2
index.analysis.analyzer.full.filter.2: asciifolding
index.analysis.analyzer.full.filter.1: lowercase
index.analysis.analyzer.full.filter.0: standard
index.analysis.analyzer.full.type: custom
index.analysis.analyzer.partial.filter.2: asciifolding
index.analysis.analyzer.partial.filter.1: lowercase
index.analysis.analyzer.partial.filter.0: standard
index.analysis.analyzer.full_non_ascii.filter.1: lowercase
index.analysis.tokenizer.location_tokenizer.type: Standard
index.analysis.analyzer.full_non_ascii.filter.0: standard
index.analysis.filter.name_ngrams.side: front
index.analysis.analyzer.partial.tokenizer: location_tokenizer
index.analysis.analyzer.partial.filter.3: name_ngrams
index.analysis.analyzer.partial_non_ascii.filter.2: name_ngrams
index.analysis.analyzer.partial_non_ascii.filter.1: lowercase
index.analysis.filter.name_ngrams.max_gram: 40
index.analysis.analyzer.partial_non_ascii.filter.0: standard
index.analysis.filter.snowball_de.type: snowball
index.analysis.analyzer.partial_non_ascii.tokenizer: location_tokenizer
index.analysis.analyzer.full.tokenizer: location_tokenizer
index.analysis.filter.name_ngrams.min_gram: 2
index.analysis.analyzer.full_non_ascii.type: custom
index.analysis.analyzer.partial.type: custom
index.analysis.analyzer.partial_non_ascii.type: custom
index.number_of_shards: 1
index.analysis.analyzer.full_non_ascii.tokenizer: location_tokenizer
}
mappings: {
location: {
properties: {
alternateNames: {
properties: {
isShortName: {
type: boolean
}
name: {
type: multi_field
fields: {
partial_non_ascii: {
include_in_all: false
index_analyzer: partial_non_ascii
store: yes
search_analyzer: full
term_vector: yes
type: string
}
full: {
include_in_all: false
store: yes
analyzer: full
term_vector: yes
type: string
}
partial: {
include_in_all: false
index_analyzer: partial
store: yes
search_analyzer: full
term_vector: yes
type: string
}
}
}
isPreferredName: {
type: boolean
}
lang: {
type: string
}
}
}
admin4: {
type: string
}
admin3: {
type: string
}
lonlat: {
type: geo_point
}
admin2: {
type: string
}
locid: {
type: long
}
admin1: {
type: string
}
asciiname: {
type: string
}
name: {
type: multi_field
fields: {
partial_non_ascii: {
include_in_all: false
index_analyzer: partial_non_ascii
store: yes
search_analyzer: full_non_ascii
term_vector: yes
type: string
}
full: {
include_in_all: false
store: yes
analyzer: full
term_vector: yes
type: string
}
partial: {
include_in_all: false
index_analyzer: partial
store: yes
search_analyzer: full
term_vector: yes
type: string
}
}
}
featureCode: {
type: string
}
countryCode: {
type: string
}
population: {
type: long
}
}
}
locationAlternateNames: {
properties: { }
}
}
aliases: [ ]
}
@BowlingX
Copy link
Author

Query:

{
  "from" : 0,
  "size" : 10,
  "query" : {
    "filtered" : {
      "query" : {
        "bool" : {
          "should" : [ {
            "text" : {
              "name.partial_non_ascii" : {
                "query" : "Düss",
                "type" : "boolean",
                "boost" : 3.0
              }
            }
          }, {
            "text" : {
              "name.partial" : {
                "query" : "Düss",
                "type" : "boolean"
              }
            }
          }, {
            "text" : {
              "alternateNames.name.partial" : {
                "query" : "Düss",
                "type" : "boolean",
                "boost" : 2.0
              }
            }
          } ]
        }
      },
      "filter" : {
        "terms" : {
          "featureCode" : [ "ppl", "ppla", "isl", "ppla2", "ppla3", "pplc", "adm1" ]
        }
      }
    }
  },
  "sort" : [ {
    "population" : {
      "order" : "desc"
    }
  } ],
  "highlight" : {
    "order" : "score",
    "fields" : {
      "alternateNames.name.partial" : {
        "fragment_size" : 150,
        "number_of_fragments" : 2
      },
      "name.partial" : {
        "fragment_size" : 150,
        "number_of_fragments" : 2
      }
    }
  }
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment