So I was doing something like
curl -XPUT $ES_HOST/blocks/block/_mapping -d '
{
"block" : { ....
The only change that I think I made was to change the "block" in the json
body to something like "initial-block-mapping".
2010/12/15 Shay Banon shay.banon@elasticsearch.com
Great that its working. What do you mean that you named the mapping same
thing as the type?2010/12/16 Pete Aykroyd aykroyd@gmail.com
Hey,
I got it working... it looks like the mistake I was making was naming my
mapping the same thing as the type. I don't know if that matters or not, but
that appears to be the only difference.Thanks for all the help!
Pete
2010/12/15 Shay Banon shay.banon@elasticsearch.com
Sounds good. And if you get the mapping back do you see the stored
mapping def for those fields?2010/12/16 Pete Aykroyd aykroyd@gmail.com
So that's what I did:
- I deleted data/*
- started elastic
- created the index with curl
- used that curl command to put the mappings
- and then indexed my docs
There were no errors while indexing, but the new fields weren't added. I
just updated to 0.13.1 to see if that would help. Sorry, if I'm being obtuse
here but it seems like I'm doing the right thing.2010/12/15 Shay Banon shay.banon@elasticsearch.com
It doesn't make a difference, but note that those mappings will only be
applied if there was no previous docs before indexed with that field. So,
delete the index, create a new one with the mappings, and then start
indexing.2010/12/16 Pete Aykroyd aykroyd@gmail.com
Oh, I see. Sorry for the confusion. I added the mappings for the fields
that I cared about with the curl command from the previous email (pasted
below). Does it make a difference whether I do it in java versus with the
REST API?Thanks,
Pete
curl -XPUT 'http://localhost:9200/blocks/block/_mapping' -d '
{"block": { "properties": { "system": { "store": "yes", "type": "string" }, "user": { "store": "yes", "type": "string" } } }}'
2010/12/15 Shay Banon shay.banon@elasticsearch.com
I don't see where you put the mapping. You can explicitly set
mappings for specific fields, and those mappings will apply for them, the
rest will be dynamic.2010/12/15 Pete Aykroyd aykroyd@gmail.com
Not sure exactly what you want. This gist has the mapping that is
generated dynamically and the code that does the indexing.
https://gist.github.com/742513
2010/12/15 Shay Banon shay.banon@elasticsearch.com
Can you gist a full recreation?
On Wednesday, December 15, 2010 at 1:12 AM, Pete Aykroyd wrote:
Thanks... that's a great pointer. I'm not seeing that because I've
been using 0.13.0. Still curious about this mapping issue though.Pete
On Tue, Dec 14, 2010 at 1:39 AM, Medcl medcl@163.com wrote:
as i know,es now can direct use _source's item as field's
value,check
it out,
Search Fields: If a field is not stored, automatically extract it from _source (without the need for _source prefix) · Issue #562 · elastic/elasticsearch · GitHubOn 12月14日, 上午10时31分, Shay Banon shay.ba...@elasticsearch.com
wrote:Setting the mapping in advance for those fields, and indexing
will retain the dynamic nature for the rest of the document. Can you maybe
gist your put mapping code, and how you detect the other fields are not
being indexed?On Tuesday, December 14, 2010 at 12:40 AM, Pete Aykroyd wrote:
Hi,
I think I'm probably missing something obvious but I can't
figure how to set a few mappings manually on my schema and retain the
automatic mappings.The exact problem is that I've been using elastic for the past
week or so completely with the dynamic schema mappings and everything was
fine. But I now want to sometimes return a field with my query... So there
are a few fields in the schema that I want to set stored to true on. For the
rest of the fields, I want them to continue to get their mappings
dynamically, since there are a lot of them and more may be added in the
future.If try to put a mapping for just that the field with data
already indexed, obviously there is a merge conflict because it has already
had indexed those fields with stored = false.
If I set ignore_conflicts to true and then re-index my data, it
doesn't seem to have any effect and checking the _mapping shows that stored
still isn't set.
I've tried blowing away the index completely, then setting a
mapping with the two fields I care about being stored in it, and then
re-indexing, but then nothing else is mapped.What's the right way to do this?
Thanks,
Pete