I'm still relatively new to Elasticsearch and can't seem to figure out
if I'm doing this correctly. I am trying to produce a query that
searches for a given string. In addition to this query I also want to
filter the results off of an integer field in the document. I am using
the request below and its working...
Sometimes there is no term provided, but I would still like to filter
the results. I have substituted the term (foobar) for "*" which I
guess matches everything. Is this a good approach for what I'm trying
to accomplish?
You are putting the facets within the "query", it should eb on the same level as the "query" (json wise).
On Wednesday, March 16, 2011 at 12:10 AM, Rob Faraj wrote:
Thanks Clint. The constant_score query worked great when there is no
term and I would like to filter by one field. However, I can't seem to
get facets to work with the constant_score query.
I've updated the gist to be a reproduction of this (see the last curl
request). The odd thing is that the response comes back fine, but
there is no facet information in the response even though it is part
of the query object sent.
Would someone mind taking a glance over the two different JSON docs I
have put together? They work as I have tested them, but I want to make
sure I'm doing things as simplistically efficient as possible.
I approve Clinton enhancements :). One note, you don't need to specify in the fields _id, since you always get it. Just provide an empty array in the fields, and it will not return the _source.
On Wednesday, March 16, 2011 at 9:57 PM, Clinton Gormley wrote:
Hi Rob
Would someone mind taking a glance over the two different JSON docs I
have put together? They work as I have tested them, but I want to make
sure I'm doing things as simplistically efficient as possible.
Those two queries are exactly the same. The field query is just a query_string query with a nicer syntax and the default_field is set to the field provided.
On Wednesday, March 16, 2011 at 10:46 PM, Rob Faraj wrote:
Thanks again. The 'terms' filter is exactly what I was looking for.
The support here is really fast and helpful. Speaks volumes to the
long term forecast of elasticsearch. Kudos to both.
I posted a follow up on gist with a question about the difference
between
Would someone mind taking a glance over the two different JSON docs I
have put together? They work as I have tested them, but I want to make
sure I'm doing things as simplistically efficient as possible.
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.