Problem in search when use "index: not_analyzed"


(Fernando Garrido) #1

Hello, i have a problem if i search for a field mapping it as "index:
not_analyed"

This is my script that create the index:

curl -XPUT 'http://localhost:9200/contenidos' -d '{
"mappings": {
"categoria": {
"_all": { "enabled": false },
"_source": { "compressed": true },
"properties": {
"name": { "type": "string", "index": "analyzed" },
"alpha": { "type": "string", "index": "not_analyzed" }
}
}
}
}'

Here the script that insert data:

curl -XPUT 'http://localhost:9200/contenidos/categoria/3371' -d '{ "name":
"Circo del Sol", "parentId": "123" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/13571' -d '{ "name":
"Circo del Sol Pepito", "parentId": "123" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/21855' -d '{ "name":
"Circo del Sol Zaragoza", "parentId": "122" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/3750' -d '{ "name":
"Circo del Sol - Corteo", "parentId": "125" }'

If i search for field "name" wthis this query all results have de same
score:

{
"explain": false,
"size": "10",
"query": {
"match": {
"name": "circo del sol"
}
}
}

But if i do the same search, but with the field "alpha", i get not results,
the query is:

{
"explain": false,
"size": "10",
"query": {
"match": {
"alpha": "circo del sol"
}
}
}

Please, if anyone has any idea how i do the search will be very gratefull.
Thanks!!

--


(David Pilato) #2

Did you index something with content in alpha field?
Your curl recreation does not show it.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 2 nov. 2012 à 20:33, Fernando Garrido fernando.garrido@soluciones3f.com.ar a écrit :

Hello, i have a problem if i search for a field mapping it as "index: not_analyed"

This is my script that create the index:

curl -XPUT 'http://localhost:9200/contenidos' -d '{
"mappings": {
"categoria": {
"_all": { "enabled": false },
"_source": { "compressed": true },
"properties": {
"name": { "type": "string", "index": "analyzed" },
"alpha": { "type": "string", "index": "not_analyzed" }
}
}
}
}'

Here the script that insert data:

curl -XPUT 'http://localhost:9200/contenidos/categoria/3371' -d '{ "name": "Circo del Sol", "parentId": "123" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/13571' -d '{ "name": "Circo del Sol Pepito", "parentId": "123" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/21855' -d '{ "name": "Circo del Sol Zaragoza", "parentId": "122" }'
curl -XPUT 'http://localhost:9200/contenidos/categoria/3750' -d '{ "name": "Circo del Sol - Corteo", "parentId": "125" }'

If i search for field "name" wthis this query all results have de same score:

{
"explain": false,
"size": "10",
"query": {
"match": {
"name": "circo del sol"
}
}
}

But if i do the same search, but with the field "alpha", i get not results, the query is:

{
"explain": false,
"size": "10",
"query": {
"match": {
"alpha": "circo del sol"
}
}
}

Please, if anyone has any idea how i do the search will be very gratefull.
Thanks!!

--


(system) #3