Great just tried it like this and totally worked, yeah is a bit confusing
but really makes sense thanks a ton.
curl -XPUT 'http://localhost:9200/geartrade/_mapping' -d
'{"item":{"properties":{"model":{"type":"string"},"itemID":{"type":"integer"},"listingDate":{"format":"dateOptionalTime","type":"date"},"condition":{"type":"string"},"type":{"type":"string"},"mainImage":{"type":"string"},"percOff":{"type":"float"},"size":{"type":"string"},"username":{"type":"string"},"category":{"type":"string"},"title":{"type":"string"},"price":{"type":"float"},"msrp":{"type":"float"},"description":{"type":"string"},"brand":{"type":"string"}}}}'
On Fri, Apr 8, 2011 at 2:52 PM, Shay Banon shay.banon@elasticsearch.comwrote:
Its because the top level field is the index name, which it shouldn't be.
The top level field should be just the type name, without the index name. I
understand (I think) where the confusion is coming from, because of the GET
Mapping API response when asking for a specific type mapping in a single
index, thats why I added this to master:
Issues · elastic/elasticsearch · GitHub.
On Friday, April 8, 2011 at 11:37 PM, Manuel Antonio Benavides Salazar
wrote:
Sure this is what I run:
curl -XPUT 'http://localhost:9200/company/item/_mapping' -d '
{"company":{
"item":{"
properties":{
"model":{"type":"string"},
"itemID":{"type":"integer"},
"listingDate":{"format":"dateOptionalTime","type":"date"},
"condition":{"type":"string"},
"type":{"type":"string"},
"mainImage":{"type":"string"},
"percOff":{"type":"float"},
"size":{"type":"string"},
"username":{"type":"string"},
"category":{"type":"string"},
"title":{"type":"string"},
"price":{"type":"float"},
"msrp":{"type":"float"},
"description":{"type":"string"},
"brand":{"type":"string"}
}
}
}}'
And when I do I get back:
{"ok":true,"acknowledged":true}
I tried with a fresh index with nothing indexed and still don't work, I
just read that you can send a mapping when you create the index so I'll try
that right now.
thanks,
On Fri, Apr 8, 2011 at 12:27 PM, Shay Banon shay.banon@elasticsearch.comwrote:
Can you provide a curl recreation? Elasticsearch Platform — Find real-time answers at scale | Elastic.
On Friday, April 8, 2011 at 5:13 PM, Manuel Antonio Benavides Salazar
wrote:
geartrade just the name of the index I changed it on the other places for
testing and forgot that one on the console I am running it OK so the syntax
is not wrong, I think then it just shouldn't say that the mapping was
updated successfully as it does, I'll give it a try with a newly fresh
index.
On Fri, Apr 8, 2011 at 1:57 AM, Clinton Gormley clinton@iannounce.co.ukwrote:
On Thu, 2011-04-07 at 15:42 -0700, Manuel Benavides wrote:
I have the following default mapping:
{"company" : {"item" : {"properties" : {
"model" : {"type" : "string"},
"itemID" : {"type" : "string"},
... trimmed ...
"description" : { "type" : "string"},
"brand" : { "type" : "string"}}}}}
Then I go and change some values and I'll need to sort them and run
queries with ranges on some of them with the following command:
curl -XPUT 'http://localhost:9200/company/item/_mapping' -d '
{"geartrade":{"item":{"properties":{
"model":{"type":"string"},
Where does "geartrade" come from?
Your mapping syntax is wrong.
Also, you can only update a mapping if it doesn't conflict with the
existing mapping. Otherwise, you need to create a new type with the new
mapping (perhaps in a new index), and reindex your data with the new
mapping.
clint