I'm new to ES. I don't think I fully understand the concept of query
and filters. In my case I just want to use filters as I am using ES
to replace mysql.
How would I convert the following SQL statement into elasticsearch
query?
SELECT * FROM advertiser
WHERE company like '%com%'
AND sales_rep IN (1,2)
Hi Yada,
First off, you really want to understand that products like
elasticsearch search against term based inverted indexes where each
term has the set of documents that contain it. The way that these
terms are created from the submitted text is the called the analysis
process and is critical to ensure the search is behaving as you wish.
While the example you posted above using wildcards will work, it won't
work efficiently. Wildcards and especially leading wildcards should be
avoided for decent performance. Instead, you should consider using an
analyzer with ngrams (Elasticsearch Platform — Find real-time answers at scale | Elastic
index-modules/analysis/ngram-tokenfilter.html) applied to break up
words into various substrings.
So, the string "test" could get broken up like this:
te
es
st
tes
est
test
I'm new to ES. I don't think I fully understand the concept of query
and filters. In my case I just want to use filters as I am using ES
to replace mysql.
How would I convert the following SQL statement into elasticsearch
query?
SELECT * FROM advertiser
WHERE company like '%com%'
AND sales_rep IN (1,2)
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.