Default-mapping.json


(David Pilato) #21

Okay : Test done with ES 0.18.5 under windows with a fresh and clean install.

Step 4 produces :
{
"test" : {
"type" : {
"_source" : {
"enabled" : false
},
"properties" : {
"test" : {
"type" : "string"
}
}
}
}
}

So Slavag seems to have something strange on its side as he said that he got for
step 4 :
{
"test" : {
"type" : {
"properties" : {
"test" : {
"type" : "string"
}
}
}
}
}

HTH,
David.

Le 13 décembre 2011 à 23:10, Shay Banon kimchy@gmail.com a écrit :

I am not really sure..., I don't see where the problem is. Can someone else
try and recreate this problem, or verify that its not happening? I will
repeat the recreation:

  1. Use a fresh elasticsearch 0.18.5 installation.
  2. Place a file called default-mapping.json under config with the following
    content:

{
"default" : {
"_source" : {"enabled" : false}
}
}

  1. Index a sample document: curl -XPUT localhost:9200/test/type/1 -d
    '{"test" : "value"}'
  2. Execute: curl localhost:9200/test/_mapping?pretty=1, and check if it has
    source enabled or not in the mapping returned.

Thanks!

On Tue, Dec 13, 2011 at 11:58 PM, slavag slavago@gmail.com wrote:

Shay , any suggestion about my problem ?

Thank You.

--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(Slava G ) #22

Hi David,
Can you please run this curl -XGET localhost:9200/test/_search?pretty=true
-d '
{
"query" : {
"term" : { "test" : "value" }
}
}
'
What is the result ?


(David Pilato) #23

Sure.

First, it's a POST request not a GET.

I get a single hit without source :
{
"took":0,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"failed":0
},
"hits":{
"total":1,
"max_score":0.30685282,
"hits":[{
"_index":"test",
"_type":"type",
"_id":"1",
"_score":0.30685282
}
]
}
}

Le 14 décembre 2011 à 15:14, slavag slavago@gmail.com a écrit :

Hi David,
Can you please run this curl -XGET localhost:9200/test/_search?pretty=true
-d '
{
"query" : {
"term" : { "test" : "value" }
}
}
'
What is the result ?
--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(Slava G ) #24

Hi David,
GET worked also, but any way I did POST and get :
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "test",
"_type" : "type",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"test" : "value"}
} ]
}
}

When curl localhost:9200/test/_mapping?pretty=1 :
returns :
{
"test" : {
"type" : {
"properties" : {
"test" : {
"type" : "string"
}
}
}
}
}

So, what could be a problem - I did exactly what you did and Shay said and
we have different results in search ?

Thank You.


(David Pilato) #25

I test it under windows using mobz inteface. That's perhaps why GET produces
nothing for me...
BTW, I remember having some troubles some months ago with mappings in conf dir.

Let me tell something that not answer directly to your concern. It could be a
better idea to send mapping to an ES node instead of having to copy on each node
a conf file.

BTW, are you really sure that your 0.18.5 is a fresh one ?
Do you have some globals var in your system (what printenv produces ?) ?

David.

Le 14 décembre 2011 à 15:37, slavag slavago@gmail.com a écrit :

Hi David,
GET worked also, but any way I did POST and get :
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "test",
"_type" : "type",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"test" : "value"}
} ]
}
}

When curl localhost:9200/test/_mapping?pretty=1 :
returns :
{
"test" : {
"type" : {
"properties" : {
"test" : {
"type" : "string"
}
}
}
}
}

So, what could be a problem - I did exactly what you did and Shay said and
we have different results in search ?

Thank You.
--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(Slava G ) #26

Hi David,
Thank for quick response , per your question - yes this is fresh 18.5 -
just unpacked it and put the mapping in the config.
Can you describe a little bit more the sending mapping to an ES node ?
As for global vars in the system I don't see any special, but is there some
global vars that has effect on the ES ?

Best Regards.


(David Pilato) #27

Here is a gist :https://gist.github.com/1477309


is the unix script to push mapping files to a node (localhost:9200)
./createMapping mymapping

It sends the mymapping.json file to ES. Then ES spread the mapping to each
nodes.


Is a sample mapping JSON file

Not sure that is what you are after but may help...

About ES VARS, I was only thinking about ES_JAVA_OPTS or JAVA_OPTS in which you
can have defined a -Des.path.data or -Des.path.conf or something like that.

Cheers

Le 14 décembre 2011 à 17:14, slavag slavago@gmail.com a écrit :

Hi David,
Thank for quick response , per your question - yes this is fresh 18.5 -
just unpacked it and put the mapping in the config.
Can you describe a little bit more the sending mapping to an ES node ?
As for global vars in the system I don't see any special, but is there some
global vars that has effect on the ES ?

Best Regards.
--
David Pilato
http://dev.david.pilato.fr/
Twitter : @dadoonet


(Slava G ) #28

David, Thank You a lot.
Looking on the script and it seems that i need it of each index, now when
my application is multi-tanant application and new index are coming as new
customer is join and even more the new index types are also can come pretty
often. So it means that I need to put mapping for every new tenant (new
index) / for every new index type.
Do you see any other solution to my case - btw, the mapping that I need for
all index type and for all tenants ( at least the the mandatory fields) are
very few : some date, id of data and user account. Those are 3 fields that
I need to store and not analyze and I have to not store _source.

Any suggestions ?

Thank You very much for your assistance.


(Shay Banon) #29

default-mapping.json works. Can you check in your logs again if you see the
node you start joining another node?

On Wed, Dec 14, 2011 at 9:11 PM, slavag slavago@gmail.com wrote:

David, Thank You a lot.
Looking on the script and it seems that i need it of each index, now when
my application is multi-tanant application and new index are coming as new
customer is join and even more the new index types are also can come pretty
often. So it means that I need to put mapping for every new tenant (new
index) / for every new index type.
Do you see any other solution to my case - btw, the mapping that I need
for all index type and for all tenants ( at least the the mandatory fields)
are very few : some date, id of data and user account. Those are 3 fields
that I need to store and not analyze and I have to not store _source.

Any suggestions ?

Thank You very much for your assistance.


(Slava G ) #30

I checked, nothing - this is stand alone home computer.


(Slava G ) #31

Hi Shay,

Any thought ? May be I need to check it in Linux OS ?


(Shay Banon) #32

Operating system does not matter. The only two reasons that I can think can
cause it is that you are not using the config location you think you are
using, or there is another node started that acts as the master with a
different configuration.

On Fri, Dec 16, 2011 at 9:35 AM, slavag slavago@gmail.com wrote:

Hi Shay,

Any thought ? May be I need to check it in Linux OS ?


(Slava G ) #33

As i said before - stand alone computer , as for config location - I never
changed it.


(system) #34