Hi,
this might be a rookie problem since I'm very new to elasticsearch.
I'm trying to put JSON documents into elasticsearch with a field "lang".
However if "lang" is set to "it" elasticsearch doesn't seem to recognize
the field since it's only returned when I filter for missing fields.
The problem can be recreated very simple:
curl -XPUT 'http://localhost:9200/test/test/1' -d '{"lang":"de"}'
curl -XPUT 'http://localhost:9200/test/test/2' -d '{"lang":"it"}'
If I try to search for lang:de:
curl -XGET http://s445.gfsrv.net:9200/test/test/_search?pretty -d
'
{
"query": {
"query_string": {
"query": "lang:de"
}
}
I get a result:
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "test",
"_type" : "test",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"lang":"de"}
} ]
}
}
However if I search for lang:it:
curl -XGET http://s445.gfsrv.net:9200/test/test/_search?pretty -d '
{
"query": {
"query_string": {
"query": "lang:it"
}
}
}'
There is no result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
If I search for missing field lang:
curl -XGET http://s445.gfsrv.net:9200/test2/test/_search?pretty -d
'{"query":{"filtered":{"filter":{"missing":{"field":"lang"}}}}}'
There it is:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test2",
"_type" : "test",
"_id" : "2",
"_score" : 1.0, "_source" : {"lang":"it"}
} ]
}
}
Thanks for your time and any help would be appreciated.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1bfddb52-2bbb-4e24-ab71-facbe365f45c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.