Hiya

It's a bit more verbose, but yes you can do queries like that easily.  I've
assumed that all of your fields are "exact value" not_analyzed string
fields, rather than full text fields:

GET /_search
{
  "_source": [ "col1", "col2" ],
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "bool": {
                "should": [
                  { "terms": { "col3": [ "some", "value" ]}},
                  { "missing": { "field": "col3" }}
                ]
              }
            },
            {
              "bool": {
                "should": [
                  { "terms": { "col4": [ "another", "set", "values" ]}},
                  { "missing": { "field": "col4" }}
                ]
              }
            },
            { "term": { "col5": "hello" }}
          ],
          "must_not": [
            { "term": { "col6": "world" }}
          ]
        }
      }
    }
  },
  "sort": "col7"
}

All of those lookups use filters, so would be cached, making all future
executions very fast indeed.


On 18 April 2014 08:37, Paul <paulj3...@gmail.com> wrote:

> Hi,
>
> We're looking to move our infrastructure to ElasticSearch and I have some
> concerns.  We plan on using this more as a database and less than a search
> engine.  I know there are some companies out there that are doing this, but
> I have some queries that, with one SQL command I can get the results I
> need, whereas ElasticSearch I would need to do filters of queries, etc.
>
>
> An example, using SQL parlance, how would I do the following statement:
>
> select col1, col2 from mytable where col3 in ["", "some", "value] and col4
> in ["another", "set", "", "values"] and col5 = "hello" and col6 not in
> "world" order by col7.
>
> This is an example of some data I would be querying, and I would be
> performing 1000's of queries at a time.
>
>
>
> So my question:  Can ElasticSearch do this and if so, how can I do the
> above query.
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/a59fcffe-5671-4ee0-a6bf-d49aedd3189b%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/a59fcffe-5671-4ee0-a6bf-d49aedd3189b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAPt3XKSKZ4uzfD3BuFtWqpnAg97Yc7m4cEtGBBbrYOoN5x7n0A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to