Re: Filter and Query same taking some time

2014-01-09 Thread Matt Weber
Use a filtered query, not an outer filter.   You only want to use that
outer filter when you are faceting and don't want the filter to change the
facet counts.

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

Thanks,
Matt Weber


On Thu, Jan 9, 2014 at 1:13 AM, Arjit Gupta arjit...@gmail.com wrote:

 I had 13 Million documents and with the same query
 I see Filters performing worse then query
 filters are taking 400ms where as query is taking 300 ms

 1. Filter

 {
   size : 100,
   query : {
 match_all : { }
   },
   filter : {
 bool : {
   must : {
 term : {
   color : red
 }
   }
 }
   },
   version : true
 }


 2. Query

 {
   size : 100,
   query : {
 bool : {
   must : {
 match : {
   color : {
 query : red,
 type : boolean,
 operator : AND
   }
 }
   }
 }
   },
   version : true
 }

 Thanks ,
 Arjit


 On Thu, Jan 9, 2014 at 1:15 PM, David Pilato da...@pilato.fr wrote:

 Yeah 10 documents is not that much!
 Not sure if you can notice a difference here as probably everything could
 be loaded in file system cache.

 --
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 9 janvier 2014 at 08:43:13, Arjit Gupta 
 (arjit...@gmail.com//arjit...@gmail.com)
 a écrit:

 I have 100,000 documents  which are similar. In response I am getting the
 whole document not just Id.
 I am executing the query multiple times.

 Thanks ,
 Arjit


 On Thu, Jan 9, 2014 at 1:06 PM, David Pilato da...@pilato.fr wrote:

  You probably won't see any difference the first time you execute it
 unless you are using warmers.
  With a second query, you should see the difference.

  How many documents you have in your dataset?

  --
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 9 janvier 2014 at 06:14:06, Arjit Gupta 
 (arjit...@gmail.com//arjit...@gmail.com)
 a écrit:

   Hi,

 I had implemented ES search query  for all our use cases but when i came
 to know that some of our use cases can be solved by filters I implemented
 that but I dont see any gain (in response time) in filters. My search
 queries  are

 1. Filter

 {
   size : 100,
   query : {
 match_all : { }
   },
   filter : {
 bool : {
   must : {
 term : {
   color : red
 }
   }
 }
   },
   version : true
 }


 2. Query

 {
   size : 100,
   query : {
 bool : {
   must : {
 match : {
   color : {
 query : red,
 type : boolean,
 operator : AND
   }
 }
   }
 }
   },
   version : true
 }

 By default the term query should be cached but I dont see a performance
 gain.
 Do i need to change some parameter also  ?
 I am using ES  0.90.1 and with 16Gb of heap space given to ES.

 Thanks,
 Arjit
  --
  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/326a6640-d887-46b4-a8e7-ec15a1c9dc98%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to a topic in the
 Google Groups elasticsearch group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/elasticsearch/uknnBHMnZLk/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 elasticsearch+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/elasticsearch/etPan.52ce519b.75c6c33a.1449b%40MacBook-Air-de-David.local.


 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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/CADe%2BHd-RzJxTrtt8gVOS6cxa%3DXNZ%3Dwa%2Bv8Vnwnqigd5gfnJ0fw%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to a topic in the
 Google Groups elasticsearch group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/elasticsearch/uknnBHMnZLk/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 elasticsearch+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 

Re: Filter and Query same taking some time

2014-01-08 Thread David Pilato
You probably won't see any difference the first time you execute it unless you 
are using warmers.
With a second query, you should see the difference.

How many documents you have in your dataset?

-- 
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr


Le 9 janvier 2014 at 06:14:06, Arjit Gupta (arjit...@gmail.com) a écrit:

Hi, 

I had implemented ES search query  for all our use cases but when i came to 
know that some of our use cases can be solved by filters I implemented that but 
I dont see any gain (in response time) in filters. My search queries  are 

1. Filter 

{
  size : 100,
  query : {
    match_all : { }
  },
  filter : {
    bool : {
      must : {
        term : {
          color : red
        }
      }
    }
  },
  version : true
}


2. Query 

{
  size : 100,
  query : {
    bool : {
      must : {
        match : {
          color : {
            query : red,
            type : boolean,
            operator : AND
          }
        }
      }
    }
  },
  version : true
}

By default the term query should be cached but I dont see a performance gain. 
Do i need to change some parameter also  ?
I am using ES  0.90.1 and with 16Gb of heap space given to ES. 

Thanks,
Arjit
--
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/326a6640-d887-46b4-a8e7-ec15a1c9dc98%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/etPan.52ce519b.75c6c33a.1449b%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Filter and Query same taking some time

2014-01-08 Thread Arjit Gupta
I have 100,000 documents  which are similar. In response I am getting the
whole document not just Id.
I am executing the query multiple times.

Thanks ,
Arjit


On Thu, Jan 9, 2014 at 1:06 PM, David Pilato da...@pilato.fr wrote:

 You probably won't see any difference the first time you execute it unless
 you are using warmers.
 With a second query, you should see the difference.

 How many documents you have in your dataset?

 --
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 9 janvier 2014 at 06:14:06, Arjit Gupta 
 (arjit...@gmail.com//arjit...@gmail.com)
 a écrit:

 Hi,

 I had implemented ES search query  for all our use cases but when i came
 to know that some of our use cases can be solved by filters I implemented
 that but I dont see any gain (in response time) in filters. My search
 queries  are

 1. Filter

 {
   size : 100,
   query : {
 match_all : { }
   },
   filter : {
 bool : {
   must : {
 term : {
   color : red
 }
   }
 }
   },
   version : true
 }


 2. Query

 {
   size : 100,
   query : {
 bool : {
   must : {
 match : {
   color : {
 query : red,
 type : boolean,
 operator : AND
   }
 }
   }
 }
   },
   version : true
 }

 By default the term query should be cached but I dont see a performance
 gain.
 Do i need to change some parameter also  ?
 I am using ES  0.90.1 and with 16Gb of heap space given to ES.

 Thanks,
 Arjit
  --
 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/326a6640-d887-46b4-a8e7-ec15a1c9dc98%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to a topic in the
 Google Groups elasticsearch group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/elasticsearch/uknnBHMnZLk/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 elasticsearch+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/elasticsearch/etPan.52ce519b.75c6c33a.1449b%40MacBook-Air-de-David.local
 .

 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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/CADe%2BHd-RzJxTrtt8gVOS6cxa%3DXNZ%3Dwa%2Bv8Vnwnqigd5gfnJ0fw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.