Does field value "it" carry special meaning?


(Jae Lee) #1

Hi

I'm finding this really weird but when I have a document like below indexed

{
"site":"it",
"message":"my site is it"
}

{
"site":"fr",
"message":"my site is fr"
}

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"it"}}}

returns me nothing where as

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"fr"}}}

returns me the 2nd document with message "my site is fr"

Is there any special thing about field value "it"?

J


(Lukáš Vlček) #2

Hi,

can it be removed during index analysis because "it" is a stopword whereas
"fr" is not?

Regards,
Lukas

On Sun, Mar 6, 2011 at 3:59 PM, Jae Lee jlee119@gmail.com wrote:

Hi

I'm finding this really weird but when I have a document like below indexed

{
"site":"it",
"message":"my site is it"
}

{
"site":"fr",
"message":"my site is fr"
}

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"it"}}}

returns me nothing where as

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"fr"}}}

returns me the 2nd document with message "my site is fr"

Is there any special thing about field value "it"?

J


(Jae Lee) #3

ah ok

yes you are right...

so what I didn't realise is that my field "index" property doesn't inherit
from root object's "index" property.

my mapping for the index was

{

"type":

{

"index":"not_analyzed",

"properties":

{

  "site":{"type":"string"}

}

}

}

then when I changed it to

{

"type":

{

"properties":

{

  "site":{"type":"string","index":"not_analyzed"}

}

}

}

it started to return those document with site field value being "it"

ok I suppose I need to rely on dynamic templates to have default index
settings to be "not_analyzed" for string type field.

{"type":

{"dynamic_templates":[

{"string_field":{

  "match":"*",

  "match_mapping_type":"string",

  "mapping":{

    "type":"string",

    "index":"not_analyzed"

  }

}}

]}

}

that probably work fine if you have enabled dynamic indexing...

what should I do if I have disabled dynamic indexing... would that leave me
with setting index property to override the default setting for string
field?

J

On Sun, Mar 6, 2011 at 3:16 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

can it be removed during index analysis because "it" is a stopword whereas
"fr" is not?

Regards,
Lukas

On Sun, Mar 6, 2011 at 3:59 PM, Jae Lee jlee119@gmail.com wrote:

Hi

I'm finding this really weird but when I have a document like below
indexed

{
"site":"it",
"message":"my site is it"
}

{
"site":"fr",
"message":"my site is fr"
}

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"it"}}}

returns me nothing where as

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"fr"}}}

returns me the 2nd document with message "my site is fr"

Is there any special thing about field value "it"?

J


(Shay Banon) #4

Yes, you will have to set it explicitly on each one (at least thats how it works now).
On Sunday, March 6, 2011 at 6:24 PM, Jae Lee wrote:

ah ok

yes you are right...

so what I didn't realise is that my field "index" property doesn't inherit from root object's "index" property.

my mapping for the index was

{
"type":
{
"index":"not_analyzed",
"properties":
{
"site":{"type":"string"}
}
}
}

then when I changed it to

{
"type":
{
"properties":
{
"site":{"type":"string","index":"not_analyzed"}
}
}
}

it started to return those document with site field value being "it"

ok I suppose I need to rely on dynamic templates to have default index settings to be "not_analyzed" for string type field.

{"type":
{"dynamic_templates":[
{"string_field":{
"match":"*",
"match_mapping_type":"string",
"mapping":{
"type":"string",
"index":"not_analyzed"
}
}}
]}
}

that probably work fine if you have enabled dynamic indexing...

what should I do if I have disabled dynamic indexing... would that leave me with setting index property to override the default setting for string field?

J

On Sun, Mar 6, 2011 at 3:16 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

can it be removed during index analysis because "it" is a stopword whereas "fr" is not?

Regards,
Lukas

On Sun, Mar 6, 2011 at 3:59 PM, Jae Lee jlee119@gmail.com wrote:

Hi

I'm finding this really weird but when I have a document like below indexed

{
"site":"it",
"message":"my site is it"
}

{
"site":"fr",
"message":"my site is fr"
}

post 127.0.0.1:9200 /index/type/_search?size=10 {"query":{"term":{"site":"it"}}}

returns me nothing where as

post 127.0.0.1:9200 /index/type/_search?size=10 {"query":{"term":{"site":"fr"}}}

returns me the 2nd document with message "my site is fr"

Is there any special thing about field value "it"?

J


(Jae Lee) #5

ok thanks Shay

On Mon, Mar 7, 2011 at 4:30 AM, Shay Banon shay.banon@elasticsearch.comwrote:

Yes, you will have to set it explicitly on each one (at least thats how
it works now).

On Sunday, March 6, 2011 at 6:24 PM, Jae Lee wrote:

ah ok

yes you are right...

so what I didn't realise is that my field "index" property doesn't inherit
from root object's "index" property.

my mapping for the index was

{

"type":

{

"index":"not_analyzed",

"properties":

{

  "site":{"type":"string"}

}

}

}

then when I changed it to

{

"type":

{

"properties":

{

  "site":{"type":"string","index":"not_analyzed"}

}

}

}

it started to return those document with site field value being "it"

ok I suppose I need to rely on dynamic templates to have default index
settings to be "not_analyzed" for string type field.

{"type":

{"dynamic_templates":[

{"string_field":{

  "match":"*",

  "match_mapping_type":"string",

  "mapping":{

    "type":"string",

    "index":"not_analyzed"

  }

}}

]}

}

that probably work fine if you have enabled dynamic indexing...

what should I do if I have disabled dynamic indexing... would that leave me
with setting index property to override the default setting for string
field?

J

On Sun, Mar 6, 2011 at 3:16 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

can it be removed during index analysis because "it" is a stopword whereas
"fr" is not?

Regards,
Lukas

On Sun, Mar 6, 2011 at 3:59 PM, Jae Lee jlee119@gmail.com wrote:

Hi

I'm finding this really weird but when I have a document like below indexed

{
"site":"it",
"message":"my site is it"
}

{
"site":"fr",
"message":"my site is fr"
}

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"it"}}}

returns me nothing where as

post 127.0.0.1:9200 /index/type/_search?size=10
{"query":{"term":{"site":"fr"}}}

returns me the 2nd document with message "my site is fr"

Is there any special thing about field value "it"?

J


(system) #6