You will have to build it from master, but it should simplify things with
the above mentioned enhancement. Note, several users define a custom
analyzer that is a keyword one but still do lowercasing, which might fit
what you are after, here is an example where the message uses it (the
analyzer was named sortable, but can be any name):
curl -s -XPOST 'http://localhost:9200/twitter' -d '
{
"index" : {
"analysis" : {
"analyzer" : {
"sortable" : {
"tokenizer" : "keyword",
"filter" : ["lowercase"]
}
}
}
}
}
'; echo
curl -XPUT 'http://localhost:9200/twitter/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string",
"analyzer" : "sortable"},
"type" : {"type" : "string",
"index" : "not_analyzed" }
}
}
}
On Wed, Jul 14, 2010 at 5:14 PM, Franz Allan Valencia See <
franz.see@gmail.com> wrote:
Thanks! It now works !
I'm on 0.8.0. Should I start using 0.9?
On Wed, Jul 14, 2010 at 10:09 PM, Shay Banon <shay.banon@elasticsearch.com
wrote:
In 0.9, if a field is "not_analyzed", then the search analyzer that will
be used for the field is the "keyword" analyzer (won't do anything to the
text provided), so the above sample provided should work (i.e. searching in
a query_string for statusCode:A).-shay.banon
On Wed, Jul 14, 2010 at 5:07 PM, Shay Banon <shay.banon@elasticsearch.com
wrote:
Which version are you using?
On Wed, Jul 14, 2010 at 4:59 PM, Franz Allan Valencia See <
franz.see@gmail.com> wrote:I just did the following:
curl -XPUT '
http://localhost:9200/dummyindex/anotherDummyJustToCreateTheIndex/1'
-d '
{
"dummy" : "dummy"
}
'curl -XPUT 'http://localhost:9200/dummyindex/dummyType/_mapping' -d '
{
"dummyType" : {"properties" : { "statusCode" : {"type" : "string", "store" : "yes", "index": "not_analyzed" }
}
}
}
'curl -XPUT 'http://localhost:9200/dummyindex/dummyType/1' -d '
{
"statusCode" : "A"
}
'curl -XPUT 'http://localhost:9200/dummyindex/dummyType/2' -d '
{
"statusCode" : "P"
}
'curl -XGET
http://localhost:9200/dummyindex/dummyType/_search?q=statusCode:Acurl -XGET
http://localhost:9200/dummyindex/dummyType/_search?q=statusCode:P
Now, I get nothing for both statusCode A and P.
Any ideas?
Thanks,
--
Franz Allan Valencia See | Java Software Engineer
franz.see@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_seeOn Wed, Jul 14, 2010 at 9:45 PM, Shay Banon <
shay.banon@elasticsearch.com> wrote:You need to set the mapping before you index data, and don't set
default, using the actual type you want to change.-shay.banon
On Wed, Jul 14, 2010 at 4:40 PM, Franz Allan Valencia See <
franz.see@gmail.com> wrote:seems like im still stuck with this whole not_analyzed thing
I did the following commands:
$ curl -XPUT 'http://localhost:9200/dummy/dummy/1' -d '
{
"statusCode" : "A"
}
'
{"ok":true,"_index":"dummy","_type":"dummy","_id":"1"}$ curl -XPUT 'http://localhost:9200/dummy/dummy/2' -d '
{
"statusCode" : "P"
}
'
{"ok":true,"_index":"dummy","_type":"dummy","_id":"2"}$ curl -XPUT 'http://localhost:9200/dummy/dummy/_mapping' -d '
{
"default" : {
"properties" : {
"statusCode" : {"type" : "string", "store" : "yes",
"index" : "not_analyzed" }
}
}
}
'
{"ok":true,"acknowledged":false}I'm not sure what "ok":"true" but "acknowledged":false is, but
searching for
http://localhost:9200/dummy/dummy/_search?q=statusCode:A still yields
no results.What am i doing wrong?
Thanks,
--
Franz Allan Valencia See | Java Software Engineer
franz.see@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_seeOn Wed, Jun 30, 2010 at 6:16 PM, Shay Banon <
shay.banon@elasticsearch.com> wrote:Usually, this type of fields (status code) should be configured to be
"not_analyzed" in the index section. Note, in this case, you will get hits
only onA, not ona.-shay.banon
On Wed, Jun 30, 2010 at 10:52 AM, Franz Allan Valencia See <
franz.see@gmail.com> wrote:ohh.....right right. Ok, I'll look into that. Thanks
On Wed, Jun 30, 2010 at 2:44 PM, Lukáš Vlček <lukas.vlcek@gmail.com
wrote:
Hi,
isn't 'a' a stop word? Depending on your analysis used during
indexing single 'a' may be removed.Regards,
LukasOn Wed, Jun 30, 2010 at 5:21 AM, Franz Allan Valencia See <
franz.see@gmail.com> wrote:Good day,
I have a field that accepts a single character - either 'A' or
'P'.I can index them no properly (i think) with:
curl -XPUT http://localhost:9200/test/dummy/1 -d '{"id" : 1,
"statusCode" : "A", "anotherCamelCase" : "A", "inverseStatusCode" : "P",
"nocamelcase" : "A", "aValue" : "A", "bValue" : "B", "pValue" : "P",
"zValue" : "Z" }'
curl -XPUT http://localhost:9200/test/dummy/2 -d '{"id" : 2,
"statusCode" : "P", "anotherCamelCase" : "P", "inverseStatusCode" : "A",
"nocamelcase" : "P", "aValue" : "a", "bValue" : "b", "pValue" : "p",
"zValue" : "z" }'Accessing these two documents with
http://localhost:9200/test/dummy/1 and
http://localhost:9200/test/dummy/2 shows me all fields that I put
in. That part is fine.Also, for the most part, searching is ok because I can retrieve
the values that I want (i.e. searching with
http://localhost:9200/test/dummy/_search?q=statusCode:P gives me
a hit which is 'test dummy 2').However, when I do search for documents wherein the value is 'A'
(or 'a') like
http://localhost:9200/test/dummy/_search?q=statusCode:A, I am not
getting any hits. I've also tried searching against the fields
'anotherCamelCase', 'inverseStatusCode', 'nocamelcase', 'aValue' and they
all can't make a match (for both "A" and "a"). Also, other letters like B,
b, P, p, Z, z seems to be ok.Are the letters "A" & "a" reserved words?
Some info on my setup:
franz@see:~$ uname -a
Linux see 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC
2010 x86_64 GNU/Linux
franz@see:~$ echo $JAVA_HOME
/opt/java/64/jdk1.6.0_17
franz@see:~$ /opt/java/64/jdk1.6.0_17/bin/java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)
franz@see:/opt/elasticsearch/active$ cat config/elasticsearch.yml#gateway:
type: hdfs
hdfs:
uri: hdfs://localhost:8020
path: /opt/vc/aptab/es-gateway
(Note: at first I was working on HDFS. But when I encountered this
problem, i tried reverting to the default setting which is an empty
elasticsearch.yml and still does not work).Thanks,
--
Franz Allan Valencia See | Java Software Engineer
franz.see@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see--
Franz Allan Valencia See | Java Software Engineer
franz.see@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see--
Franz Allan Valencia See | Java Software Engineer
franz.see@gmail.com
LinkedIn: http://www.linkedin.com/in/franzsee
Twitter: http://www.twitter.com/franz_see