Skip to content

Instantly share code, notes, and snippets.

@johnnypeck
Created November 13, 2012 20:55
Show Gist options
  • Save johnnypeck/4068334 to your computer and use it in GitHub Desktop.
Save johnnypeck/4068334 to your computer and use it in GitHub Desktop.
returnsAllRecords
This returns all records when used in elastic search head. When used through elastica the response is "no query registered for not" from elastic search. I'm much more concerned about getting it to work in elastic search head so I at least know the query/mapping to use.
Mapping:
{
state: open
settings: {
index.number_of_shards: 5
index.number_of_replicas: 1
index.version.created: 191099
}
mappings: {
property: {
properties: {
streetAddress: {
include_in_all: true
analyzer: snowball
type: string
}
amenities: {
include_in_all: true
type: string
}
numFullBathrooms: {
include_in_all: true
type: string
}
location: {
lat_lon: true
type: geo_point
}
zipcode: {
include_in_all: true
type: string
}
cityName: {
include_in_all: true
analyzer: snowball
type: string
}
numFloorsInUnit: {
include_in_all: true
type: string
}
stateCode: {
include_in_all: true
type: string
}
numBedrooms: {
include_in_all: true
type: string
}
streetIntersection: {
include_in_all: true
type: string
}
ratePerDay: {
include_in_all: true
type: float
}
numHalfBathrooms: {
include_in_all: true
type: string
}
id: {
include_in_all: true
type: string
}
leases: {
include_in_all: true
properties: {
start: {
include_in_all: true
format: dateOptionalTime
type: date
}
end: {
include_in_all: true
format: dateOptionalTime
type: date
}
}
type: nested
}
unitNumber: {
include_in_all: true
type: string
}
county: {
include_in_all: true
type: string
}
description: {
include_in_all: true
type: string
}
name: {
include_in_all: true
type: string
}
locationNeighborhood.name: {
include_in_all: true
analyzer: snowball
type: string
}
listingTitle: {
include_in_all: true
type: string
}
hasDisabledAccess: {
include_in_all: true
type: string
}
}
}
}
aliases: [ ]
}
The query:
{
"query" : {
"filtered": {
"query": { "match_all" : {}},
"filter": {
"not": {
"nested": {
"path": "leases",
"filter": {
"and": [
{
"range": {
"leases.start.date" : {
"from": "2009-05-06 00:00:00",
"include_upper": true
}
}
},
{
"range": {
"leases.end.date": {
"from": "2009-05-29 00:00:00",
"include_lower": true
}
}
}
]
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment