_id and mappings

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon
On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

Am I incorrect in thinking that this should return an item that has an
_id of 40716 in the 'serc' index?

curl -XGET http://localhost:9200/serc/_search?pretty=true -d '{"query":
{"term":{"_id":40716}}}'

Do I just need to set this field's index property to 'not_analyzed'?
What are the benefits of storing the _id field?

Would an index template apply to future indexes that are created or
only to existing indexes when the command is issued?

I need the _id because some external records point to unique documents
and link various processes & states to the document(item). I don't
want to use _uid because I'd like to set the id dynamically although
it's just sequential...

I appreciate your quick response.

On May 22, 8:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon

On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

On Monday, May 23, 2011 at 5:18 AM, Bryan Green wrote:
Am I incorrect in thinking that this should return an item that has an

_id of 40716 in the 'serc' index?

curl -XGET http://localhost:9200/serc/_search?pretty=true -d '{"query":
{"term":{"_id":40716}}}'
This will not work if _id is not indexed. But, you can use the ids filter / ids query which do not require the _id to be indexed (use the internal _uid and are actually faster).

Do I just need to set this field's index property to 'not_analyzed'?
You don't really need to if you use the ids filter / query.
What are the benefits of storing the _id field?
Donno, you wanted to do it :). You get the _id back for all operations without storing it.

Would an index template apply to future indexes that are created or
only to existing indexes when the command is issued?
Only on future ones.

I need the _id because some external records point to unique documents
and link various processes & states to the document(item). I don't
want to use _uid because I'd like to set the id dynamically although
it's just sequential...

I appreciate your quick response.

On May 22, 8:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon

On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

Hi,

I tried using the 'ids' query/filter but it seems to require a type
which I don't always know when trying to pull data back via the '_id'.
Is there anyway around this? Define all types?

If I simply want to have the _id accessible to the filter and queries
what is the right way to map it? just map "index":"not_analyzed" for
'_id'?

I tried using an index template as well but this seems to require that
you define the type within the json. Is there anyway to affect all
types using an index template? I tried a few things here as well but
no luck.

Thank you,
Bryan

On May 22, 9:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

On Monday, May 23, 2011 at 5:18 AM, Bryan Green wrote:

Am I incorrect in thinking that this should return an item that has an> _id of 40716 in the 'serc' index?

curl -XGEThttp://localhost:9200/serc/_search?pretty=true-d '{"query":
{"term":{"_id":40716}}}'

This will not work if _id is not indexed. But, you can use the ids filter / ids query which do not require the _id to be indexed (use the internal _uid and are actually faster).

Do I just need to set this field's index property to 'not_analyzed'?

You don't really need to if you use the ids filter / query.> What are the benefits of storing the _id field?

Donno, you wanted to do it :). You get the _id back for all operations without storing it.

Would an index template apply to future indexes that are created or
only to existing indexes when the command is issued?

Only on future ones.

I need the _id because some external records point to unique documents
and link various processes & states to the document(item). I don't
want to use _uid because I'd like to set the id dynamically although
it's just sequential...

I appreciate your quick response.

On May 22, 8:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon

On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

Well, with luck I think I answered most of my last question.

This is how I get the template to work:
$ curl -XPUT localhost:9200/_template/template_1 -d '
{
"template": "*",
"mappings": {
"{type}": {
"_id": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
'

The document will now be returned searching on the '_id' term. And in
only 2ms!

I guess I don't understand why the index param is set to
"not_analyzed." I don't understand the English behind this. Why is it
not being analyzed and now available?

What an awesome system!
-Bryan

On May 23, 6:04 am, Bryan Green bryogr...@gmail.com wrote:

Hi,

I tried using the 'ids' query/filter but it seems to require a type
which I don't always know when trying to pull data back via the '_id'.
Is there anyway around this? Define all types?

If I simply want to have the _id accessible to the filter and queries
what is the right way to map it? just map "index":"not_analyzed" for
'_id'?

I tried using an index template as well but this seems to require that
you define the type within the json. Is there anyway to affect all
types using an index template? I tried a few things here as well but
no luck.

Thank you,
Bryan

On May 22, 9:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

On Monday, May 23, 2011 at 5:18 AM, Bryan Green wrote:

Am I incorrect in thinking that this should return an item that has an> _id of 40716 in the 'serc' index?

curl -XGEThttp://localhost:9200/serc/_search?pretty=true-d'{"query":
{"term":{"_id":40716}}}'

This will not work if _id is not indexed. But, you can use the ids filter / ids query which do not require the _id to be indexed (use the internal _uid and are actually faster).

Do I just need to set this field's index property to 'not_analyzed'?

You don't really need to if you use the ids filter / query.> What are the benefits of storing the _id field?

Donno, you wanted to do it :). You get the _id back for all operations without storing it.

Would an index template apply to future indexes that are created or
only to existing indexes when the command is issued?

Only on future ones.

I need the _id because some external records point to unique documents
and link various processes & states to the document(item). I don't
want to use _uid because I'd like to set the id dynamically although
it's just sequential...

I appreciate your quick response.

On May 22, 8:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon

On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

To correct my last post, this is how I got it to work on all types:

--default-mapping.json--
{
"default":{
"_id": {
"type": "string",
"index": "not_analyzed"
}
}
}

I couldn't actually get the templates to work dynamically with
multiple types.

Back to work :slight_smile:
-Bryan

On May 23, 6:18 am, Bryan Green bryogr...@gmail.com wrote:

Well, with luck I think I answered most of my last question.

This is how I get the template to work:
$ curl -XPUT localhost:9200/_template/template_1 -d '
{
"template": "*",
"mappings": {
"{type}": {
"_id": {
"type": "string",
"index": "not_analyzed"
}
}
}}

'

The document will now be returned searching on the '_id' term. And in
only 2ms!

I guess I don't understand why the index param is set to
"not_analyzed." I don't understand the English behind this. Why is it
not being analyzed and now available?

What an awesome system!
-Bryan

On May 23, 6:04 am, Bryan Green bryogr...@gmail.com wrote:

Hi,

I tried using the 'ids' query/filter but it seems to require a type
which I don't always know when trying to pull data back via the '_id'.
Is there anyway around this? Define all types?

If I simply want to have the _id accessible to the filter and queries
what is the right way to map it? just map "index":"not_analyzed" for
'_id'?

I tried using an index template as well but this seems to require that
you define the type within the json. Is there anyway to affect all
types using an index template? I tried a few things here as well but
no luck.

Thank you,
Bryan

On May 22, 9:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

On Monday, May 23, 2011 at 5:18 AM, Bryan Green wrote:

Am I incorrect in thinking that this should return an item that has an> _id of 40716 in the 'serc' index?

curl -XGEThttp://localhost:9200/serc/_search?pretty=true-d'{"query":
{"term":{"_id":40716}}}'

This will not work if _id is not indexed. But, you can use the ids filter / ids query which do not require the _id to be indexed (use the internal _uid and are actually faster).

Do I just need to set this field's index property to 'not_analyzed'?

You don't really need to if you use the ids filter / query.> What are the benefits of storing the _id field?

Donno, you wanted to do it :). You get the _id back for all operations without storing it.

Would an index template apply to future indexes that are created or
only to existing indexes when the command is issued?

Only on future ones.

I need the _id because some external records point to unique documents
and link various processes & states to the document(item). I don't
want to use _uid because I'd like to set the id dynamically although
it's just sequential...

I appreciate your quick response.

On May 22, 8:20 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

The _id definition should exists on the same level as the top level properties. Its type is always string btw. Can I ask why do you need it analyzed? What are you missing? Also, 99% chance that you don't really need it to be stored as well (you get it back on all operations without it being stored).

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

-shay.banon

On Monday, May 23, 2011 at 4:09 AM, Bryan Green wrote:

Hi,

I'd like to index the '_id' field for all types across all indexes.
How do I do this? I have a clean index from 0.16.1.

Can I place this in the default-mapping.json file:?
{
"default" : {
"properties" : {
"_id": {
"type":"long",
"index": "not_analyzed",
"store": "yes"
}
}
}
}

It doesn't seem to work.

Also, I am trying to dynamically create mappings for all types in an
index. Is there a way to do this via the /config/mapping/_default/
*.json route or do I need to specifically define the type for each
mapping? I dynamically create the types so I'll never really know
every type that could be created.

Thanks a lot for everyone's effort on this project. A special shout-
out to Shay.

Thanks,
Bryan

Hi,

Just a question about that :

Yes, you can place all mappings in config/mapping/_default/*.json. I personally like the index template option that does not really require you to mess with local configuration of each node.

You talk about config/mapping dir but in documentation, it's supposed to be in :

config/mappings/_default or config/mappings/[index_name]

There is a s at mapping...

So what is the right name ?

I'm trying to define a mapping for my index but it doesn't work for me...
I can only define a mapping using curl -XPUT ...

So I'm wondering if :

  • defining mapping in config files really works ? I tried it on 0.15.2 and 0.16.1.
  • documentation is correct ?
  • my own mapping file is correct or not

Thanks for any help.
Cheers

My configuration is as follows:

  • config
    • elasticsearch.yml
    • mappings
      • indexName
        • typeName.json

I tell nothing peculiar inside elasticsearch.yml. (You can change settings
of the default file name/path for the default mapping, but I don't use it).

My typeName.json looks as follows (trimmed down):

{
"typeName" : {
"_source" : {"enabled":false},
"dynamic" : "strict",
"properties" : {
"text" : {"type":"string", "index":"analyzed", "store":true,
"include_in_all":false, "analyzer":"simple"}
}
}
}

Hope that helps.

Cheers

Olivier Favre

www.yakaz.com

2011/5/23 dpilato [via Elasticsearch Users] <
ml-node+2975551-361198208-393975@n3.nabble.com>

Hi,

Just a question about that :

kimchy wrote:
Yes, you can place all mappings in config/mapping/_default/*.json. I
personally like the index template option that does not really require you
to mess with local configuration of each node.

You talk about config/mapping dir but in documentationhttp://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html,
it's supposed to be in :

config/mappings/_default or config/mappings/[index_name]

There is a s at mapping...

So what is the right name ?

I'm trying to define a mapping for my index but it doesn't work for me...
I can only define a mapping using curl -XPUT ...

So I'm wondering if :

  • defining mapping in config files really works ? I tried it on 0.15.2 and
    0.16.1.
  • documentation is correct ?
  • my own mapping file is correct or not

Thanks for any help.
Cheers


If you reply to this email, your message will be added to the discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp2973448p2975551.html
To start a new topic under Elasticsearch Users, email
ml-node+115913-1699315842-393975@n3.nabble.com
To unsubscribe from Elasticsearch Users, click herehttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=115913&code=b2xpdmllckB5YWthei5jb218MTE1OTEzfDIxMjI2MTYwOTc=.

I'm guessing the documentation is correct. I indeed did have my
mappings in the "mappings" folder.

So far, I've had my best success using the /config/default-
mapping.json file.

What does "dynamic" : "strict" do?

On May 23, 10:14 am, ofavre oliv...@yakaz.com wrote:

My configuration is as follows:

  • config
    • elasticsearch.yml
    • mappings
      • indexName
        • typeName.json

I tell nothing peculiar inside elasticsearch.yml. (You can change settings
of the default file name/path for the default mapping, but I don't use it).

My typeName.json looks as follows (trimmed down):

{
"typeName" : {
"_source" : {"enabled":false},
"dynamic" : "strict",
"properties" : {
"text" : {"type":"string", "index":"analyzed", "store":true,
"include_in_all":false, "analyzer":"simple"}
}
}

}

Hope that helps.

Cheers

Olivier Favre

www.yakaz.com

2011/5/23 dpilato [via Elasticsearch Users] <
ml-node+2975551-361198208-393...@n3.nabble.com>

Hi,

Just a question about that :

kimchy wrote:
Yes, you can place all mappings in config/mapping/_default/*.json. I
personally like the index template option that does not really require you
to mess with local configuration of each node.

You talk about config/mapping dir but in documentationhttp://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html,
it's supposed to be in :

config/mappings/_default or config/mappings/[index_name]

There is a s at mapping...

So what is the right name ?

I'm trying to define a mapping for my index but it doesn't work for me...
I can only define a mapping using curl -XPUT ...

So I'm wondering if :

  • defining mapping in config files really works ? I tried it on 0.15.2 and
    0.16.1.
  • documentation is correct ?
  • my own mapping file is correct or not

Thanks for any help.
Cheers


If you reply to this email, your message will be added to the discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297...
To start a new topic under Elasticsearch Users, email
ml-node+115913-1699315842-393...@n3.nabble.com
To unsubscribe from Elasticsearch Users, click herehttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.....

--
View this message in context:http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297...
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Shay Banon skrev 2011-05-23 04:20:

What are the benefits of storing the _id field?
Donno, you wanted to do it :). You get the _id back for all
operations without storing it.

Can I sort on _id without having it indexed?

/Kristian

No.
On Tuesday, May 24, 2011 at 10:03 AM, Kristian Jörg wrote:

Shay Banon skrev 2011-05-23 04:20:

What are the benefits of storing the _id field?
Donno, you wanted to do it :). You get the _id back for all
operations without storing it.

Can I sort on _id without having it indexed?

/Kristian

Bryan Green,

Quote from
Elasticsearch Platform — Find real-time answers at scale | Elastic in the
dynamic section (between properties and enabled):

The dynamic parameter can also be set to strict, meaning that not only new
fields will not be introduced into the mapping, parsing (indexing) docs with
such new fields will fail.

Somehow I preferred using dynamic=strict rather than dynamic=false because
ES did not seem to react to false as it should have (ie: ignore the
malformed document), but I was beginning with the technology.
Using strict ensures it will fail indexing it and the malformed document
won't be stored/indexed/anything.
*
*
Shay: Maybe tests should be done, this might be a bug, now I think about
it...

--
Olivier Favre

www.yakaz.com

2011/5/23 Bryan Green bryogreen@gmail.com

I'm guessing the documentation is correct. I indeed did have my
mappings in the "mappings" folder.

So far, I've had my best success using the /config/default-
mapping.json file.

What does "dynamic" : "strict" do?

On May 23, 10:14 am, ofavre oliv...@yakaz.com wrote:

My configuration is as follows:

  • config
    • elasticsearch.yml
    • mappings
      • indexName
        • typeName.json

I tell nothing peculiar inside elasticsearch.yml. (You can change
settings
of the default file name/path for the default mapping, but I don't use
it).

My typeName.json looks as follows (trimmed down):

{
"typeName" : {
"_source" : {"enabled":false},
"dynamic" : "strict",
"properties" : {
"text" : {"type":"string", "index":"analyzed", "store":true,
"include_in_all":false, "analyzer":"simple"}
}
}

}

Hope that helps.

Cheers

Olivier Favre

www.yakaz.com

2011/5/23 dpilato [via Elasticsearch Users] <
ml-node+2975551-361198208-393...@n3.nabble.com>

Hi,

Just a question about that :

kimchy wrote:
Yes, you can place all mappings in config/mapping/_default/*.json. I
personally like the index template option that does not really require
you
to mess with local configuration of each node.

You talk about config/mapping dir but in documentation<
Elasticsearch Platform — Find real-time answers at scale | Elastic>,
it's supposed to be in :

config/mappings/_default or config/mappings/[index_name]

There is a s at mapping...

So what is the right name ?

I'm trying to define a mapping for my index but it doesn't work for
me...
I can only define a mapping using curl -XPUT ...

So I'm wondering if :

  • defining mapping in config files really works ? I tried it on 0.15.2
    and
    0.16.1.
  • documentation is correct ?
  • my own mapping file is correct or not

Thanks for any help.
Cheers


If you reply to this email, your message will be added to the
discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297.
..
To start a new topic under Elasticsearch Users, email
ml-node+115913-1699315842-393...@n3.nabble.com
To unsubscribe from Elasticsearch Users, click here<
http://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet....>.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297...
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

What is the bug? If you set dynamic to false, it means that new fields will simply be ignored, but indexing of the doc will not fail.
On Tuesday, May 24, 2011 at 1:30 PM, Olivier Favre wrote:

Bryan Green,

Quote from Elasticsearch Platform — Find real-time answers at scale | Elastic in the dynamic section (between properties and enabled):

The dynamic parameter can also be set to strict, meaning that not only new fields will not be introduced into the mapping, parsing (indexing) docs with such new fields will fail.

Somehow I preferred using dynamic=strict rather than dynamic=false because ES did not seem to react to false as it should have (ie: ignore the malformed document), but I was beginning with the technology.
Using strict ensures it will fail indexing it and the malformed document won't be stored/indexed/anything.

Shay: Maybe tests should be done, this might be a bug, now I think about it...

--
Olivier Favre

www.yakaz.com

2011/5/23 Bryan Green bryogreen@gmail.com

I'm guessing the documentation is correct. I indeed did have my
mappings in the "mappings" folder.

So far, I've had my best success using the /config/default-
mapping.json file.

What does "dynamic" : "strict" do?

On May 23, 10:14 am, ofavre oliv...@yakaz.com wrote:

My configuration is as follows:

  • config
  • elasticsearch.yml
  • mappings
  • indexName
  • typeName.json

I tell nothing peculiar inside elasticsearch.yml. (You can change settings
of the default file name/path for the default mapping, but I don't use it).

My typeName.json looks as follows (trimmed down):

{
"typeName" : {
"_source" : {"enabled":false},
"dynamic" : "strict",
"properties" : {
"text" : {"type":"string", "index":"analyzed", "store":true,
"include_in_all":false, "analyzer":"simple"}
}
}

}

Hope that helps.

Cheers

Olivier Favre

www.yakaz.com

2011/5/23 dpilato [via Elasticsearch Users] <
ml-node+2975551-361198208-393...@n3.nabble.com>

Hi,

Just a question about that :

kimchy wrote:
Yes, you can place all mappings in config/mapping/_default/*.json. I
personally like the index template option that does not really require you
to mess with local configuration of each node.

You talk about config/mapping dir but in documentationhttp://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html,
it's supposed to be in :

config/mappings/_default or config/mappings/[index_name]

There is a s at mapping...

So what is the right name ?

I'm trying to define a mapping for my index but it doesn't work for me...
I can only define a mapping using curl -XPUT ...

So I'm wondering if :

  • defining mapping in config files really works ? I tried it on 0.15.2 and
    0.16.1.
  • documentation is correct ?
  • my own mapping file is correct or not

Thanks for any help.
Cheers


If you reply to this email, your message will be added to the discussion
below:

http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297...
To start a new topic under Elasticsearch Users, email
ml-node+115913-1699315842-393...@n3.nabble.com
To unsubscribe from Elasticsearch Users, click herehttp://elasticsearch-users.115913.n3.nabble.com/template/NamlServlet.....

--
View this message in context:http://elasticsearch-users.115913.n3.nabble.com/id-and-mappings-tp297...
Sent from the Elasticsearch Users mailing list archive at Nabble.com.

Thanks Olivier,

With your help, I found what was wrong.

My use case was :

  1.  Push one document to ES -> so dynamic mapping start
    
  2.  Create json mapping file and put it in
    

mappings/indexName/typeName.json

  1.  Get the json mapping
    

When I ask for the mapping,
http://localhost:9200/indexName/typeName/_mapping I get only the first one.

To make it working, I have to :

  1.  Clean my ES cluster
    
  2.  Create json mapping file and put it in
    

mappings/indexName/typeName.json

  1.  Push one document to ES -> so mapping defined in config file is
    

applied

  1.  Get the json mapping
    

So, as Shay told before (If I understood correctly), it’s really better to
push the mapping through an http/Rest request than setting up all nodes

Perhaps, it could be useful for others to write in the
http://www.elasticsearch.org/guide/reference/mapping/conf-mappings.html
documentation, that it’s not a good practice to define mappings with config
files

Thanks to all

David.

De : ofavre [mailto:olivier@yakaz.com]
Envoyé : lundi 23 mai 2011 17:15
À : users@elasticsearch.com
Objet : Re: _id and mappings

My configuration is as follows:

  • config

  • elasticsearch.yml

  • mappings

  • indexName

  • typeName.json

I tell nothing peculiar inside elasticsearch.yml. (You can change settings
of the default file name/path for the default mapping, but I don't use it).

My typeName.json looks as follows (trimmed down):

{

  "typeName" : {

    "_source" : {"enabled":false},

    "dynamic" : "strict",

    "properties" : {

      "text" : {"type":"string", "index":"analyzed",
"store":true, "include_in_all":false, "analyzer":"simple"}

    }

  }

}

Hope that helps.

Cheers

--

Olivier Favre

http://www.yakaz.com/img/logo_yakaz_small.png

http://www.yakaz.com www.yakaz.com