Hi, I have a document with many fields, and one of them is an array (a
topics array). Currently that array has only one entry per document but in
the future we'll have more entries. The thing is that I can't make an exact
query on the topic array field when looking for more than one term in it.
Let say the documents stored have one of the following values on that
field: Martin, Martin Ariel, Ariel, Kyheo
So a doc will look something like this:
{
'text': 'some random text',
'date': '2011-12-12T15:17:35.000Z'.
'topics': ['Martin']
}
I'm doing this query (1) and the problem is that all the docs with Kyheoor Martin or Martin Ariel in the topic field are returned, but I only want
those having Kyheo or Martin. I'm stuck, looked in the docs but got
confused. Any help please ?
Make the field as not_analyzed, then it will be exact match. Though, in
your case, you are testing for lowercase value, so if you want to ignore
casing, you will need to create a custom analyzed with a keyword tokenized
and a lowercase filter, and then associate it with the topics field in your
mapping.
Hi, I have a document with many fields, and one of them is an array (a
topics array). Currently that array has only one entry per document but in
the future we'll have more entries. The thing is that I can't make an exact
query on the topic array field when looking for more than one term in it.
Let say the documents stored have one of the following values on that
field: Martin, Martin Ariel, Ariel, Kyheo
So a doc will look something like this:
{
'text': 'some random text',
'date': '2011-12-12T15:17:35.000Z'.
'topics': ['Martin']
}
I'm doing this query (1) and the problem is that all the docs with Kyheoor Martin or Martin Ariel in the topic field are returned, but I only
want those having Kyheo or Martin. I'm stuck, looked in the docs but
got confused. Any help please ?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.