Failed to parse mapping via JS, but not via Curl


(Lee Gee) #1

When I send my schema via JS, I get:

 Failed to parse mapping [posting]: analyzer [toy_analyzer] not found for field [message]

When I have the script print out the schema, and copy it into a curl request, I get:

{"acknowledged" : true}

I've been looking at this for too long to see any error — please help!

The mapping is below, and pretty much came from the ES site.

The code to send it worked until I added filters earlier...

 client.indices.create({ index: $index, body: $schemaBody });

$schemaBody =
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"index": {
"analysis": {
"filter": {
"english_stop": {
"type": "stop",
"stopwords": "english"
},
"english_stemmer": {
"type": "stemmer",
"language": "english"
},
"english_possessive_stemmer": {
"type": "stemmer",
"language": "possessive_english"
}
},
"analyzer": {
"toy_analyzer": {
"tokenizer": "standard",
"filter": [
"asciifolding",
"english_possessive_stemmer",
"lowercase",
"english_stop",
"english_stemmer"
]
}
}
}
}
},
"mappings": {
"user": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"source": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"idfromsite": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"location": {
"type": "string",
"analyzer": "toy_analyzer",
"include_in_all": true
}
}
},
"posting": {
"properties": {
"id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"userid": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"source": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"idfromsite": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"type": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"created": {
"type": "date",
"index": "not_analyzed",
"include_in_all": false
},
"message": {
"type": "string",
"analyzer": "toy_analyzer",
"include_in_all": true
},
"story": {
"type": "string",
"analyzer": "toy_analyzer",
"include_in_all": true
}
}
}
}
}


(Lee Gee) #2

I deleted and re-entered the code, and now it seems to work — I guess it was just a typo.

How can I delete this post?

TIA
Lee


(system) #3