OpenSearch/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java

860 lines
26 KiB
Java
Raw Normal View History

/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.search;
import org.apache.lucene.search.BooleanClause.Occur;
2015-12-18 12:43:47 -08:00
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BoostQuery;
2015-12-18 12:43:47 -08:00
import org.apache.lucene.search.Collector;
import org.apache.lucene.search.FieldDoc;
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.elasticsearch.Version;
import org.elasticsearch.action.search.SearchShardTask;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.index.IndexService;
2016-01-14 15:21:59 +01:00
import org.elasticsearch.index.IndexSettings;
Upgrade master to lucene 5.0 snapshot This has a lot of improvements in lucene, particularly around memory usage, merging, safety, compressed bitsets, etc. On the elasticsearch side, summary of the larger changes: API changes: postings API became a "pull" rather than "push", collector API became per-segment, etc. packaging changes: add lucene-backwards-codecs.jar as a dependency. improvements to boolean filtering: especially ensuring it will not be slow for SparseBitSet. use generic BitSet api in plumbing so that concrete bitset type is an implementation detail. use generic BitDocIdSetFilter api for dedicated bitset cache, so there is type safety. changes to support atomic commits implement Accountable.getChildResources (detailed memory usage API) for fielddata, etc change handling of IndexFormatTooOld/New, since they no longer extends CorruptIndexException Closes #8347. Squashed commit of the following: commit d90d53f5f21b876efc1e09cbd6d63c538a16cd89 Author: Simon Willnauer <simonw@apache.org> Date: Wed Nov 5 21:35:28 2014 +0100 Make default codec/postings/docvalues format constants commit cb66c22c71cd304a36e7371b199a8c279908ae37 Merge: d4e2f6d ad4ff43 Author: Robert Muir <rmuir@apache.org> Date: Wed Nov 5 11:41:13 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit d4e2f6dfe767a5128c9b9ae9e75036378de08f47 Merge: 4e5445c 4111d93 Author: Robert Muir <rmuir@apache.org> Date: Wed Nov 5 06:26:32 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 4e5445c775f580730eb01360244e9330c0dc3958 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 16:19:19 2014 -0500 FixedBitSet -> BitSet commit 9887ea73e8b857eeda7f851ef3722ef580c92acf Merge: 1bf8894 fc84666 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 15:26:25 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 1bf8894430de3e566d0dc5623b0cc28b0d674ebb Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 15:22:51 2014 -0500 remove nocommit commit a9c2a2259ff79c69bae7806b64e92d5f472c18c8 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:48:43 2014 -0500 turn jenkins red again commit 067baaaa4d52fce772c81654dcdb5051ea79139f Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:18:21 2014 -0500 unzip from stream commit 82b6fba33d362aca2313cc0ca495f28f5ebb9260 Merge: b2214bb 6523cd9 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:10:59 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit b2214bb093ec2f759003c488c3c403c8931db914 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:09:53 2014 -0500 go back to my URL until we can figure out what is up with jenkins commit e7d614172240175a51f580aeaefb6460d21cede9 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 10:52:54 2014 -0500 try this jenkins commit 337a3c7704efa7c9809bf373152d711ee55f876c Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 16:17:49 2014 +0100 Rename temp-files under lock to prevent metadata reads while renaming commit 77d5ba80d0a76efa549dd753b9f114b2f2d2d29c Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 10:07:11 2014 -0500 continue to treat too-old/too-new as corruption for now commit 98d0fd2f4851bc50e505a94ca592a694d502c51c Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 09:24:21 2014 -0500 fix last nocommit commit 643fceed66c8caf22b97fc489d67b4a2a90a1a1c Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 14:46:17 2014 +0100 remove NoSuchDirectoryException commit 2e43c4feba05cfaf451df70f946c0930cbcc4557 Merge: 93826e4 8163107 Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 14:38:00 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 93826e4d56a6a97c2074669014af77ff519bde63 Merge: 7f10129 44e24d3 Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 12:54:27 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade Conflicts: src/main/java/org/elasticsearch/index/store/DistributorDirectory.java src/main/java/org/elasticsearch/index/store/Store.java src/main/java/org/elasticsearch/indices/recovery/RecoveryStatus.java src/test/java/org/elasticsearch/index/store/DistributorDirectoryTest.java src/test/java/org/elasticsearch/index/store/StoreTest.java src/test/java/org/elasticsearch/indices/recovery/RecoveryStatusTests.java commit 7f10129364623620575c109df725cf54488b3abb Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:32:24 2014 +0100 Fix TopHitsAggregator to not ignore the top-level/leaf collector split. commit 042fadc8603b997bdfdc45ca44fec70dc86774a6 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:31:20 2014 +0100 Remove MatchDocIdSet in favor of DocValuesDocIdSet. commit 7d877581ff5db585a674c95ac391ac78a0282826 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:10:08 2014 +0100 Make the and filter use the cost API. Lucene 5 ensured that cost() can safely be used, and this will have the benefit that the order in which filters are specified is not important anymore (only for slow random-access filters in practice). commit 78f1718aa2cd82184db7c3a8393e6215f43eb4a8 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 23:55:17 2014 -0500 fix previous eclipse import braindamage commit 186c40e9258ce32f22a9a714ab442a310b6376e0 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 22:32:34 2014 -0500 allow child queries to exhaust iterators again commit b0b1271305e1b6d0c4c4da51a3c54df1aa5c0605 Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 14:50:44 2014 -0800 Fix nocommit for mapping output. index_options will not be printed if the field is not indexed. commit ba223eb85e399c9620a347a983e29bf703953e7a Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 14:07:26 2014 -0800 Remove no commit for chinese analyzer provider. We should have a separate issue to address not using this provider on new indexes. commit ca554b03c4471797682b2fb724f25205cf040c4a Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 13:41:59 2014 -0800 Fix stop tests commit de67c4653ec47dee9c671390536110749d2bb05f Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 12:51:17 2014 -0800 Remove analysis nocommits, switching over to Lucene43*Filters for backcompat commit 50cae9bec72c25c33a1ab8a8931bccb3355171e2 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 15:32:25 2014 -0500 add ram accounting and TODO lazy-loading (its no worse than master, can be a followup improvement) for suggesters commit 7a7f0122f138684b312d0f0b03dc2a9c16c15f9c Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 15:11:26 2014 -0500 bump lucene version commit cd0cae5c35e7a9e049f49ae45431f658fb86676b Merge: 446bc09 3c72073 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 14:49:05 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 446bc09b4e8bf4602d3c252b53ddaa0da65cce2f Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 14:46:30 2014 -0500 remove hack commit a19d85a968d82e6d00292b49630ef6ff2dbf2f32 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 12:53:11 2014 -0500 dont create exceptions with circular references on corruption (will open a PR for this) commit 0beefb9e821d97c37e90ec556d81ac7b00369b8a Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 11:47:14 2014 -0500 temporarily add craptastic detector for this horrible bug commit e9f2d298bff75f3d1591f8622441e459c3ce7ac3 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:56:01 2014 -0500 add nocommit commit e97f1d50a91a7129650b8effc7a9ecf74ca0569a Merge: c57a3c8 f1f50ac Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:12:12 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit c57a3c8341ed61dca62eaf77fad6b8b48aeb6940 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:11:46 2014 -0500 fix nocommit commit dd0e77e4ec07c7011ab5f6b60b2ead33dc2333d2 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 09:54:09 2014 -0500 nocommit -> TODO, this is in much more places in the codebase, bigger issue commit 3cc3bf56d72d642059f8fe220d6f2fed608363e9 Author: Ryan Ernst <ryan@iernst.net> Date: Sat Nov 1 23:59:17 2014 -0700 Remove nocommit and awaitsfix for edge ngram filter test. commit 89f115245155511c0fbc0d5ee62e63141c3700c1 Author: Ryan Ernst <ryan@iernst.net> Date: Sat Nov 1 23:57:44 2014 -0700 Fix EdgeNGramTokenFilter logic for version <= 4.3, and fixed instanceof checks in corresponding tests to correctly check for reverse filter when applicable. commit 112df869cd199e36aab0e1a7a288bb1fdb2ebf1c Author: Robert Muir <rmuir@apache.org> Date: Sun Nov 2 00:08:30 2014 -0400 execute geo disjoint query/filter as intersects commit e5061273cc685f1252e9a3a9ae4877ec9bce7752 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:58:59 2014 -0400 remove chinese analyzer from docs commit ea1af11b8978fcc551f198e24fe21d52806993ef Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:29:00 2014 -0400 fix ram accounting bug commit 53c0a42c6aa81aa6bf81d3aa77b95efd513e0f81 Merge: e3bcd3c 6011a18 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:16:29 2014 -0400 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit e3bcd3cc07a4957e12c7b3affc462c31290a9186 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:15:01 2014 -0400 fix url-email back compat (thanks ryan) commit 91d6b096a96c357755abee167098607223be1aad Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:11:26 2014 -0400 bump lucene version commit d2bb9568df72b37ec7050d25940160b8517394bc Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 20:33:07 2014 -0400 remove nocommit commit 1d049c471e19e5c457262c7399c5bad9e023b2e3 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 20:28:58 2014 -0400 fix eclipse to group org/com imports together: without this, its madness commit 09d8c1585ee99b6e63be032732c04ef6fed84ed2 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 14:27:41 2014 -0400 remove nocommit, if you dont liek it, print assembly and tell me how it can be better commit 8a6a294313fdf33b50c7126ec20c07867ecd637c Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 20:01:55 2014 +0100 Remove deprecated usage of DocIdSets.newDocIDSet. commit 601bee60543610558403298124a84b1b3bbd1045 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 14:13:18 2014 -0400 maybe one of these zillions of annotations will stop thread leaks commit 9d3f69abc7267c5e455aefa26db95cb554b02d62 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 14:05:39 2014 -0400 fix some analysis nocommits commit 312e3a29c77214b8142d21c33a6b2c2b151acf9a Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 18:28:45 2014 +0100 Remove XConstantScoreQuery/XFilteredQuery/ApplyAcceptedDocsFilter. commit 5a0cb9f8e167215df7f1b1fad11eec6e6c74940f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 17:06:45 2014 +0100 Fix misleading documentation of DocIdSets.toCacheable. commit 8b4ef2b5b476fff4c79c0c2a0e4769ead26cf82b Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 17:05:59 2014 +0100 Fix CustomRandomAccessFilterStrategy to override the right method. commit d7a9a407a615987cfffc651f724fbd8795c9c671 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 16:21:35 2014 +0100 Better handle the special case when there is a single SHOULD clause. commit 648ad389f07e92dfc451f345549c9841ba5e4c9a Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 15:53:38 2014 +0100 Cut over XBooleanFilter to BitDocIdSet.Builder. The idea is similar to what happened to Lucene's BooleanFilter. Yet XBooleanFilter is a bit more sophisticated and I had to slightly change the way it is implemented in order to make it work. The main difference with before is that slow filters are now applied lazily, so eg. if you have 3 MUST clauses, two with a fast iterator and the third with a slow iterator, the previous implementation used to apply the fast iterators first and then only check the slow filter for bits which were set in the bit set. Now we are computing a bit set based on the fast must clauses and then basically returning a BitsFilteredDocIdSet.wrap(bitset, slowClause). Other than that, BooleanFilter still uses the bitset optimizations when or-ing and and-ind filters. Another improvement is that BooleanFilter is now aware of the cost API. commit b2dad312b4bc9f931dc3a25415dd81c0d9deee08 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 10:18:53 2014 -0400 clear nocommit commit 4851d2091e744294336dfade33906c75fbe695cd Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 15:15:16 2014 +0100 cut over to RoaringDocIdSet commit ca6aec24a901073e65ce4dd6b70964fd3612409e Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:57:30 2014 +0100 make nocommit more explicit commit d0742ee2cb7a6c48b0bbb31580b7fbcebdb6ec40 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:55:24 2014 -0400 fix standardtokenizer nocommit commit 7d6faccafff22a86af62af0384838391d46695ca Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:54:08 2014 +0100 fix compilation commit a038a405c1ff6458ad294e6b5bc469e622f699d0 Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:53:43 2014 +0100 fix compilation commit 30c9e307b1f5d80e2deca3392c0298682241207f Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:52:35 2014 +0100 fix compilation commit e5139bc5a0a9abd2bdc6ba0dfbcb7e3c2e7b8481 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:52:16 2014 -0400 clear nocommit here commit 85dd2cedf7a7994bed871ac421cfda06aaf5c0a5 Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:46:17 2014 +0100 fix CompletionPostingsFormatTest commit c0f3781f616c9b0ee3b5c4d0998810f595868649 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:38:00 2014 -0400 add tests for these analyzers commit 51f9999b4ad079c283ae762c862fd0e22d00445f Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:10:26 2014 +0100 remove nocommit - this is not an issue commit fd1388fa03e622b0738601c8aeb2dbf7949a6dd2 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 14:07:01 2014 +0100 Remove redundant null check commit 3d6dd51b0927337ba941a235446b22e8cd500dc3 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 14:01:37 2014 +0100 Removed the work around to prevent p/c error when invoking #iterator() twice, because the custom query filter wrapper now doesn't transform the result to a cache doc id set any more. I think the transforming to a cachable doc id set in CustomQueryWrappingFilter isn't needed at all, because we use the DocIdSet only once and because of that is just slowed things down. commit 821832a537e00cd1216064b379df3e01d2911d3a Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:54:33 2014 +0100 one more nocommit commit 77eb9ea4c4ea50afb2680c29682ddcb3851a9d4f Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 13:52:29 2014 +0100 Remove cast commit a400573c034ed602221f801b20a58a9186a06eae Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:49:24 2014 +0100 fix stop filter commit 51746087cf8ec34c4d20aa05ba8dbff7b3b43eec Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:21:36 2014 +0100 fix changed semantics of FBS.nextSetBit to check for NO_MORE_DOCS commit 8d0a4e2511310f1293860823fe3ba80ac771bbe3 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 08:13:44 2014 -0400 do the bogus cast differently commit 46a5cc5732dea096c0c80ae5ce42911c9c51e44e Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:00:16 2014 +0100 I hate it but P/C now passes commit 580c0c2f82bbeacf217e594f22312b11d1bdb839 Merge: a9d3c00 1645434 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 06:54:31 2014 -0400 fix nocommit/classcast commit a9d3c004d62fe04989f49a897e6ff84973c06eb9 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 08:49:31 2014 +0100 Update TODO. commit aa75af0b407792aeef32017f03a6f442ed970baa Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 19:18:25 2014 -0400 clear obselete nocommits from lucene bump commit d438534cf41fcbe2d88070e2f27c994625e082c2 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 18:53:20 2014 -0400 throw classcastexception when ES abuses regular filtercache for nested docs commit 2c751f3a8feda43ec127c34769b069de21f3d16f Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 18:31:34 2014 -0400 bump lucene revision, fix tests commit d6ef7f6304ae262bf6228a7d661b2a452df332be Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 22:37:58 2014 +0100 fix merge problems commit de9d361f88a9ce6bb3fba85285de41f223c95767 Merge: 41f6aab f6b37a3 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 22:28:59 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade Conflicts: pom.xml src/main/java/org/elasticsearch/Version.java src/main/java/org/elasticsearch/gateway/local/state/meta/MetaDataStateFormat.java commit 41f6aab388aa80c40b08a2facab2617576203a0d Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:48:46 2014 +0100 fix potiential NPE commit c4428b12e1ae838b91e847df8b4a8be7f49e10f4 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:38:46 2014 +0100 don't advance iterator in a match(doc) method commit 28ab948e99e3ea4497c9b1e468384806ba7e1790 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:34:58 2014 +0100 don't advance iterator in a match(doc) method commit eb0f33f6634fadfcf4b2bf7327400e568f0427bb Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 16:55:54 2014 +0100 fix GeoUtilsTest commit 7f711fe3eaf73b6c2268cf42d5a41132a61ad831 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 16:43:16 2014 +0100 Use a dedicated default index option if field type is not indexed by default commit 78e3f37ab779e3e1b25b45a742cc86ab5f975149 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 10:56:14 2014 -0400 disable this test with AwaitsFix to reduce noise commit 9a590f563c8e03a99ecf0505c92d12d7ab20d11d Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 09:38:49 2014 +0100 fix lucene version commit abe3ca1d8bb6b5101b545198f59aec44bacfa741 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 09:35:05 2014 +0100 fix AnalyzingCompletionLookupProvider to wrok with new codec API commit 464293b245852d60bde050c6d3feb5907dcfbf5f Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:26:00 2014 -0400 don't try to write stuff to tests class directory commit 031cc6c19f4fe4423a034b515f77e5a0e282a124 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:12:36 2014 -0400 AwaitsFix these known issues to reduce noise commit 4600d51891e35847f2d344247d6f915a0605c0d1 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:06:53 2014 -0400 openbitset lives on commit 8492bae056249e2555d24acd55f1046b66a667c4 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:42:54 2014 -0400 fixes for filter tests commit 31f24ce4efeda31f97eafdb122346c7047a53bf2 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:12:38 2014 -0400 don't use fieldcache commit 8480789942fdff14a6d2b2cd8134502fe62f20c8 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:04:29 2014 -0400 ancient index no longer supported commit 02e78dc7ebdd827533009f542582e8db44309c57 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 23:37:02 2014 +0100 fix more tests commit ff746c6df23c50b3f3ec24922413b962c8983080 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 23:08:19 2014 +0100 fix all mapper commit e4fb84b517107b25cb064c66f83c9aa814a311b2 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:55:54 2014 +0100 fix distributor tests and cut over to FileStore API commit 20c850e2cfe3210cd1fb9e232afed8d4ac045857 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:42:18 2014 +0100 use DOCS_ONLY if index=true and current options == null commit 44169c108418413cfe51f5ce23ab82047463e4c2 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:33:36 2014 +0100 Fix index=yes|no settings in mappers commit a3c5f77987461a18121156ed345d42ded301c566 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:51:41 2014 +0100 fix several field mappers conversion from setIndexed to indexOptions commit df84d736908e88a031d710f98e222be68ae96af1 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:33:35 2014 +0100 fix SourceFieldMapper to be not indexed commit b2bf01d12a8271a31fb2df601162d0e89924c8f5 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:23:08 2014 +0100 Cut over to .liv files in store and corruption tests commit 619004df436f9ef05d24bef1b6a7f084c6b0ad75 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 17:05:52 2014 +0100 fix more tests commit b7ed653a8b464de446e00456bce0a89e47627c38 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 16:19:08 2014 +0100 [STORE] Add dedicated method to write temporary files Recovery writes temporary files which might not end up in the right distributor directories today. This commit adds a dedicated API that allows specifying the target file name in order to create the tempoary file in the correct directory. commit 7d574659f6ae04adc2b857146ad0d8d56ca66f12 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 10:28:49 2014 -0400 add some leniency to temporary bogus method commit f97022ea7c2259f7a5cf97d924c59ed75ab65b32 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 10:24:17 2014 -0400 fix MultiCollector bug commit b760533128c2b4eb10ad76e9689ef714293dd819 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:56:08 2014 +0100 CheckIndex is now closeable we need to close it commit 9dae9fb6d63546a6c2427be2a2d5c8358f5b1934 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:45:11 2014 +0100 s/Lucene51/Lucene50 commit 7aea9b86856a8c1b06a08e7c312ede1168af1287 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:42:30 2014 +0100 fix BloomFilterPostingsFormat commit 16fea6fe842e88665d59cc091e8224e8dc6ce08c Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:41:16 2014 +0100 fix some codec format issues commit 3d77aa97dd2c4012b63befef3f2ba2525965e8a6 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:30:43 2014 +0100 fix CodecTests commit 6ef823b1fde25657438ace1aabd9d552d6ae215e Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:26:47 2014 +0100 make it compile commit 9991eee1fe99435118d4dd42b297ffc83fce5ec5 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 09:12:43 2014 -0400 add an ugly hack for TopHitsAggregator for now commit 03e768a01fcae6b1f4cb50bcceec7d42977ac3e6 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:01:02 2014 +0100 cut over ES090PostingsFormat commit 463d281faadb794fdde3b469326bdaada25af048 Merge: 0f8740a 8eac79c Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 08:30:36 2014 -0400 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 0f8740a782455a63524a5a82169f6bbbfc613518 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 01:00:15 2014 -0400 fix/hack remaining filter and analysis issues commit df534488569da13b31d66e581456dfd4b55156b9 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 23:11:47 2014 -0400 fix ngrams / openbitset usage commit 11f5dc3b9887f4da80a0fa1818e1350b30599329 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 22:42:44 2014 -0400 hack over sort comparators commit 4ebdc754350f512596f6a02770d223e9f5f7975a Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 21:27:07 2014 -0400 compiler errors < 100 commit 2d60c9e29de48ccb0347dd87f7201f47b67b83a0 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 03:13:08 2014 -0400 clear some nocommits around ram usage commit aaf47fe6c0aabcfb2581dd456fc50edf871da758 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 12:27:34 2014 -0400 migrate fieldinfo handling commit ef6ed6d15d8def71cd880d97249678136cd29fe3 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 12:07:13 2014 -0400 more simple fixes commit f475e1048ae697dd9da5bd9da445102b0b7bc5b3 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 11:58:21 2014 -0400 more fielddata ram accounting fixes commit 16b4239eaa9b4262df258257df4f31d39f28a3a2 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:47:32 2014 +0100 add missing file commit 5b542fa2a6da81e36a0c35b8e891a1d8bc58f663 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:43:29 2014 +0100 cut over completion posting formats - still some nocommits commit ecdea49404c4ec4e1b78fb54575825f21b4e096e Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 11:21:09 2014 -0400 fielddata accountable fixes commit d43da265718917e20c8264abd43342069198fe9c Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:19:53 2014 +0100 cut over BloomFilterPostings to new API commit 29b192ba621c14820175775d01242162b88bd364 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 10:22:51 2014 -0400 fix more analyzers commit 74b4a0c5283e323a7d02490df469497c722780d2 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 09:54:25 2014 -0400 fix tests commit 554084ccb4779dd6b1c65fa7212ad1f64f3a6968 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:51:48 2014 +0100 maintain supressed exceptions on CorruptIndexException commit cf882d9112c5e8ef1e9f2b0f800f7aa59001a4f2 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:47:17 2014 +0100 commitOnClose=false commit ebb2a9189ab2f459b7c6c9985be610fd90dfe410 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:46:06 2014 +0100 cut over indexwriter closeing in InternalEngine commit cd21b3d4706f0b562bd37792d077d60832aff65f Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:38:10 2014 +0100 fix constant commit f93f900c4a1c90af3a21a4af5735a7536423fe28 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 09:50:49 2014 -0400 fix test commit a9a752940b1ab4699a6a08ba8b34afca82b843fe Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Mon Oct 27 09:26:18 2014 +0100 Be explicit about the index options commit d9ee815babd030fa2ceaec9f467c105ee755bf6b Author: Simon Willnauer <simonw@apache.org> Date: Sun Oct 26 20:03:44 2014 +0100 cut over store and directory commit b3f5c8e39039dd8f5caac0c4dd1fc3b1116e64ca Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 13:08:39 2014 -0400 more test fixes commit 8842f2684e3606aae0860c27f7a4c53e273d47fb Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 12:14:52 2014 -0400 tests manual labor commit c43de5aec337919a3fdc3638406dff17fc80bc98 Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 11:04:13 2014 -0400 BytesRef -> BytesRefBuilder commit 020c0d087a2f37566a1db390b0e044ebab030138 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:53:37 2014 +0100 Moved over to BitSetFilter commit 48dd1b909e6c52cef733961c9ecebfe4f67109fe Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:53:11 2014 +0100 Left over Collector api change in ScanContext commit 6ec248ef63f262bcda400181b838fd9244752625 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:47:40 2014 +0100 Moved indexed() over to indexOptions != null or indexOptions == null commit 9937aebfd8546ae4bb652cd976b3b43ac5ab7a63 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 13:26:31 2014 +0100 Fixed many compile errors. Mainly around the breaking Collector api change in 5.0. commit fec32c4abc0e3309cf34260c8816305a6f820c9e Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 11:22:17 2014 -0400 more easy fixes commit dab22531d801800d17a65dc7c9464148ce8ebffd Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 09:33:41 2014 -0400 more progress commit 414767e9a955010076b0497cc4f6d0c1850b48d3 Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 06:33:17 2014 -0400 more progress commit ad9d969fddf139a8830254d3eb36a908ba87cc12 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 24 14:28:01 2014 -0400 current state of fun commit 464475eecb0be15d7d084135ed16051f76a7e521 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 24 11:42:41 2014 -0400 bump to 5.0 snapshot
2014-11-05 15:48:51 -05:00
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.mapper.ObjectMapper;
import org.elasticsearch.index.mapper.TypeFieldMapper;
import org.elasticsearch.index.query.AbstractQueryBuilder;
import org.elasticsearch.index.query.ParsedQuery;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryShardContext;
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
import org.elasticsearch.index.search.NestedHelper;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.search.aggregations.SearchContextAggregations;
import org.elasticsearch.search.collapse.CollapseContext;
import org.elasticsearch.search.dfs.DfsSearchResult;
import org.elasticsearch.search.fetch.FetchPhase;
import org.elasticsearch.search.fetch.FetchSearchResult;
import org.elasticsearch.search.fetch.StoredFieldsContext;
import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext;
import org.elasticsearch.search.fetch.subphase.FetchFieldsContext;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext;
import org.elasticsearch.search.fetch.subphase.highlight.SearchHighlightContext;
import org.elasticsearch.search.internal.ContextIndexSearcher;
import org.elasticsearch.search.internal.ScrollContext;
import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.internal.SearchContextId;
import org.elasticsearch.search.internal.ShardSearchRequest;
Add ability to profile query and collectors Provides a new flag which can be enabled on a per-request basis. When `"profile": true` is set, the search request will execute in a mode that collects detailed timing information for query components. ``` GET /test/test/_search { "profile": true, "query": { "match": { "foo": "bar" } } } ``` Closes #14889 Squashed commit of the following: commit a92db5723d2c61b8449bd163d2f006d12f9889ad Merge: 117dd99 3f87b08 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 17 09:44:10 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 117dd9992e8014b70203c6110925643769d80e62 Merge: 9b29d68 82a64fd Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Dec 15 13:27:18 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler Conflicts: core/src/main/java/org/elasticsearch/search/SearchService.java commit 9b29d6823a71140ecd872df25ff9f7478e7fe766 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 16:13:23 2015 -0500 [TEST] Profile flag needs to be set, ensure searches go against primary only for consistency commit 4d602d8ad1f8cbc7b475450921fa3bc7d395b34f Merge: 8b48e87 7742c1e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:25 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 8b48e876348b163ab730eeca7fa35142165b05f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:01 2015 -0500 Delegate straight to in.matchCost, no need for profiling commit fde3b0587911f0b5f15e779c671d0510cbd568a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:28:23 2015 -0500 Documentation tweaks, renaming build_weight -> create_weight commit 46f5e011ee23fe9bb8a1f11ceb4fa9d19fe48e2e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:27:52 2015 -0500 Profile TwoPhaseIterator should override matchCost() commit b59f894ddb11b2a7beebba06c4ec5583ff91a7b2 Merge: 9aa1a3a b4e0c87 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 14:23:26 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 9aa1a3a25c34c9cd9fffaa6114c25a0ec791307d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:48 2015 -0500 Revert "Move some of the collector wrapping logic into ProfileCollectorBuilder" This reverts commit 02cc31767fb76a7ecd44a302435e93a05fb4220e. commit 57f7c04cea66b3f98ba2bec4879b98e4fba0b3c0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:31 2015 -0500 Revert "Rearrange if/else to make intent clearer" This reverts commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00. commit 2874791b9c9cd807113e75e38be465f3785c154e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:38:13 2015 -0500 Revert "Move state into ProfileCollectorBuilder" This reverts commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6. commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 3 11:21:55 2015 -0500 Move state into ProfileCollectorBuilder commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:21:12 2015 -0500 Rearrange if/else to make intent clearer commit 511db0af2f3a86328028b88a6b25fa3dfbab963b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:12:06 2015 -0500 Rename WEIGHT -> BUILD_WEIGHT commit 02cc31767fb76a7ecd44a302435e93a05fb4220e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:11:22 2015 -0500 Move some of the collector wrapping logic into ProfileCollectorBuilder commit e69356d3cb4c60fa281dad36d84faa64f5c32bc4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:12:35 2015 -0500 Cleanup imports commit c1b4f284f16712be60cd881f7e4a3e8175667d62 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:11:25 2015 -0500 Review cleanup: Make InternalProfileShardResults writeable commit 9e61c72f7e1787540f511777050a572b7d297636 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:01:22 2015 -0500 Review cleanup: Merge ProfileShardResult, InternalProfileShardResult. Convert to writeable commit 709184e1554f567c645690250131afe8568a5799 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:38:08 2015 -0500 Review cleanup: Merge ProfileResult, InternalProfileResult. Convert to writeable commit 7d72690c44f626c34e9c608754bc7843dd7fd8fe Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:01:34 2015 -0500 Review cleanup: use primitive (and default) for profile flag commit 97d557388541bbd3388cdcce7d9718914d88de6d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:09:12 2015 -0500 Review cleanup: Use Collections.emptyMap() instead of building an empty one explicitly commit 219585b8729a8b0982e653d99eb959efd0bef84e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:08:12 2015 -0500 Add todo to revisit profiler architecture in the future commit b712edb2160e032ee4b2f2630fadf131a0936886 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:05:32 2015 -0500 Split collector serialization from timing, use writeable instead of streamable Previously, the collector timing was done in the same class that was serialized, which required leaving the collector null when serializing. Besides being a bit gross, this made it difficult to change the class to Writeable. This splits up the timing (InternalProfileCollector + ProfileCollector) and the serialization of the times (CollectorResult). CollectorResult is writeable, and also acts as the public interface. commit 6ddd77d066262d4400e3d338b11cebe7dd27ca78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 13:15:12 2015 -0500 Remove dead code commit 06033f8a056e2121d157654a65895c82bbe93a51 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 12:49:51 2015 -0500 Review cleanup: Delegate to in.getProfilers() Note: Need to investigate how this is used exactly so we can add a test, it isn't touched by a normal inner_hits query... commit a77e13da21b4bad1176ca2b5d5b76034fb12802f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:59:58 2015 -0500 Review cleanup: collapse to single `if` statement commit e97bb6215a5ebb508b0293ac3acd60d5ae479be1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:39:43 2015 -0500 Review cleanup: Return empty map instead of null for profile results Note: we still need to check for nullness in SearchPhaseController, since an empty/no-hits result won't have profiling instantiated (or any other component like aggs or suggest). Therefore QuerySearchResult.profileResults() is still @Nullable commit db8e691de2a727389378b459fa76c942572e6015 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 10:14:47 2015 -0500 Review cleanup: renaming, formatting fixes, assertions commit 9011775fe80ba22c2fd948ca64df634b4e32772d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:09:52 2015 -0500 [DOCS] Add missing annotation commit 4b58560b06f08d4b99b149af20916ee839baabd7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:07:17 2015 -0500 [DOCS] Update documentation for new format commit f0458c58e5538ed8ec94849d4baf3250aa9ec841 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:14:09 2015 +0100 Reduce visibility of internal classes. commit d0a7d319098e60b028fa772bf8a99b2df9cf6146 Merge: e158070 1bdf29e Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:09:18 2015 +0100 Merge branch 'master' into query_profiler commit e158070a48cb096551f3bb3ecdcf2b53bbc5e3c5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:08:48 2015 +0100 Fix compile error due to bad html in javadocs. commit a566b5d08d659daccb087a9afbe908ec3d96cd6e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:37 2015 -0500 Remove unused collector commit 4060cd72d150cc68573dbde62ca7321c47f75703 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:10 2015 -0500 Comment cleanup commit 43137952bf74728f5f5d5a8d1bfc073e0f9fe4f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:32:06 2015 -0500 Fix negative formatted time commit 5ef3a980266326aff12d4fe380f73455ff28209f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 17:10:17 2015 +0100 Fix javadocs. commit 276114d29e4b17a0cc0982cfff51434f712dc59e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 16:25:23 2015 +0100 Fix: include rewrite time as well... commit 21d9e17d05487bf4903ae3d2ab6f429bece2ffef Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 15:10:15 2015 +0100 Remove TODO about profiling explain. commit 105a31e8e570efb879447159c3852871f5cf7db4 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:59:30 2015 +0100 Fix nocommit now that the global collector is a root collector. commit 2e8fc5cf84adb1bfaba296808c329e5f982c9635 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:53:38 2015 +0100 Make collector wrapping more explicit/robust (and a bit less magical). commit 5e30b570b0835e1ce79a57933a31b6a2d0d58e2d Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 12:44:03 2015 +0100 Simplify recording API a bit. commit 9b453afced6adc0a59ca1d67d90c28796b105185 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:54:25 2015 +0100 Fix serialization-related nocommits. commit ad97b200bb123d4e9255e7c8e02f7e43804057a5 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:46:30 2015 +0100 Fix DFS. commit a6de06986cd348a831bd45e4f524d2e14d9e03c3 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:29:16 2015 +0100 Remove forbidden @Test annotation. commit 4991a28e19501109af98026e14756cb25a56f4f4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:25:59 2015 +0100 Limit the impact of query profiling on the SearchContext API. Rule is: we can put as much as we want in the search.profile package but should aim at touching as little as possible other areas of the code base. commit 353d8d75a5ce04d9c3908a0a63d4ca6e884c519a Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 18:05:09 2015 +0100 Remove dead code. commit a3ffafb5ddbb5a2acf43403c946e5ed128f47528 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:35 2015 +0100 Remove call to forbidden String.toLowerCase() API. commit 1fa8c7a00324fa4e32bd24135ebba5ecf07606f1 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:27 2015 +0100 Fix compilation. commit 2067f1797e53bef0e1a8c9268956bc5fb8f8ad97 Merge: 22e631f fac472f Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:21:12 2015 +0100 Merge branch 'master' into query_profiler commit 22e631fe6471fed19236578e97c628d5cda401a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:52:05 2015 -0500 Fix and simplify serialization of shard profile results commit 461da250809451cd2b47daf647343afbb4b327f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:32:22 2015 -0500 Remove helper methods, simpler without them commit 5687aa1c93d45416d895c2eecc0e6a6b302139f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:29:32 2015 -0500 [TESTS] Fix tests for new rewrite format commit ba9e82857fc6d4c7b72ef4d962d2102459365299 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 30 15:28:14 2015 -0400 Rewrites begone! Record all rewrites as a single time metric commit 5f28d7cdff9ee736651d564f71f713bf45fb1d91 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:36:06 2015 -0400 Merge duplicate rewrites into one entry By using the Query as the key in a map, we can easily merge rewrites together. This means the preProcess(), assertion and main query rewrites all get merged together. Downside is that rewrites of the same Query (hashcode) but in different places get lumped together. I think the simplicity of the solution is better than the slight loss in output fidelity. commit 9a601ea46bb21052746157a45dcc6de6bc350e9c Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:28:27 2015 -0400 Allow multiple "searches" per profile (e.g. query + global agg) commit ee30217328381cd83f9e653d3a4d870c1d2bdfce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:29:18 2015 -0400 Update comment, add nullable annotation commit 405c6463a64e118f170959827931e8c6a1661f13 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:04:30 2015 -0400 remove out-dated comment commit 2819ae8f4cf1bfd5670dbd1c0e06195ae457b58f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:47 2015 +0100 Don't render children in the profiles when there are no children. commit 7677c2ddefef321bbe74660471603d202a4ab66f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:35 2015 +0100 Set the profiler on the ContextIndexSearcher. commit 74a4338c35dfed779adc025ec17cfd4d1c9f66f5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:01 2015 +0100 Fix json rendering. commit 6674d5bebe187b0b0d8b424797606fdf2617dd27 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:20:19 2015 +0100 Revert "nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called" This reverts commit d3dc10949024342055f0d4fb7e16c7a43423bfab. commit d3dc10949024342055f0d4fb7e16c7a43423bfab Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 17:20:57 2015 -0400 nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called Previously, it was enabled by using DefaultSearchContext as a third-party "proxy", but since the refactor to make it unit testable, setProfile() needs to be called explicitly. Unfortunately, this is not possible because SearchService only has access to an IndexSearcher. And it is not cast'able to a DefaultIndexSearcher. commit b9ba9c5d1f93b9c45e97b0a4e35da6f472c9ea53 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:27:00 2015 -0400 [TESTS] Fix unit tests commit cf5d1e016b2b4a583175e07c16c7152f167695ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:22:34 2015 -0400 Increment token after recording a rewrite commit b7d08f64034e498533c4a81bff8727dd8ac2843e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:14:09 2015 -0400 Fix NPE if a top-level root doesn't have children commit e4d3b514bafe2a3a9db08438c89f0ed68628f2d6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:47 2015 -0400 Fix NPE when profiling is disabled commit 445384fe48ed62fdd01f7fc9bf3e8361796d9593 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:37 2015 -0400 [TESTS] Fix integration tests commit b478296bb04fece827a169e7522df0a5ea7840a3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 15:43:24 2015 -0400 Move rewrites to their own section, remove reconciliation Big commit because the structural change affected a lot of the wrapping code. Major changes: - Rewrites are now in their own section in the response - Reconciliation is gone...we don't attempt to roll the rewrites into the query tree structure - InternalProfileShardResults (plural) simply holds a Map<String, InternalProfileShardResult> and helps to serialize / ToXContent - InternalProfileShardResult (singular) is now the holder for all shard-level profiling details. Currently this includes query, collectors and rewrite. In the future it would hold suggest, aggs, etc - When the user requests the profiled results, they get back a Map<String, ProfileShardResult> instead of doing silly helper methods to convert to maps, etc - Shard details are baked into a string instead of serializing the object commit 24819ad094b208d0e94f17ce9c3f7c92f7414124 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 10:25:38 2015 -0400 Make Profile results immutable by removing relative_time commit bfaf095f45fed74194ef78160a8e5dcae1850f9e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:54:59 2015 +0200 Add nocommits. commit e9a128d0d26d5b383b52135ca886f2c987850179 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:39:37 2015 +0200 Move all profile-related classes to the same package. commit f20b7c7fdf85384ecc37701bb65310fb8c20844f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:33:14 2015 +0200 Reorganize code a bit to ease unit testing of ProfileCollector. commit 3261306edad6a0c70f59eaee8fe58560f61a75fd Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:07:28 2015 +0200 Remove irrelevant nocommit. commit a6ac868dad12a2e17929878681f66dbd0948d322 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:06:45 2015 +0200 Make CollectorResult's reason a free-text field to ease bw compat. commit 5d0bf170781a950d08b81871cd1e403e49f3cc12 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 16:50:52 2015 +0200 Add unit tests for ProfileWeight/ProfileScorer. commit 2cd88c412c6e62252504ef69a59216adbb574ce4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:55:17 2015 +0200 Rename InternalQueryProfiler to Profiler. commit 84f5718fa6779f710da129d9e0e6ff914fd85e36 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:53:58 2015 +0200 Merge InternalProfileBreakdown into ProfileBreakdown. commit 135168eaeb8999c8117ea25288104b0961ce9b35 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 13:56:57 2015 +0200 Make it possible to instantiate a ContextIndexSearcher without SearchContext. commit 5493fb52376b48460c4ce2dedbe00cc5f6620499 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:53:29 2015 +0200 Move ProfileWeight/Scorer to their own files. commit bf2d917b9dae3b32dfc29c35a7cac4ccb7556cce Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:38:24 2015 +0200 Fix bug that caused phrase queries to fail. commit b2bb0c92c343334ec1703a221af24a1b55e36d53 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:36:17 2015 +0200 Parsing happens on the coordinating node now. commit 416cabb8621acb5cd8dfa77374fd23e428f52fe9 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:22:17 2015 +0200 Fix compilation (in particular remove guava deps). commit f996508645f842629d403fc2e71c1890c0e2cac9 Merge: 4616a25 bc3b91e Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 10:44:38 2015 +0200 Merge branch 'master' into query_profiler commit 4616a25afffe9c24c6531028f7fccca4303d2893 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:32 2015 -0400 Make Java Count API compatible with profiling commit cbfba74e16083d719722500ac226efdb5cb2ff55 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:19 2015 -0400 Fix serialization of profile query param, NPE commit e33ffac383b03247046913da78c8a27e457fae78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 11:17:48 2015 -0400 TestSearchContext should return null Profiler instead of exception commit 73a02d69b466dc1a5b8a5f022464d6c99e6c2ac3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:07:29 2015 -0400 [DOCS] Update docs to reflect new ID format commit 36248e388c354f954349ecd498db7b66f84ce813 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:03:03 2015 -0400 Use the full [node][index][shard] string as profile result ID commit 5cfcc4a6a6b0bcd6ebaa7c8a2d0acc32529a80e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:51:40 2015 -0400 Add failing test for phrase matching Stack trace generated: [2015-10-15 17:50:54,438][ERROR][org.elasticsearch.search.profile] shard [[JNj7RX_oSJikcnX72aGBoA][test][2]], reason [RemoteTransportException[[node_s0][local[1]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: AssertionError[nextPosition() called more than freq() times!]; ], cause [java.lang.AssertionError: nextPosition() called more than freq() times! at org.apache.lucene.index.AssertingLeafReader$AssertingPostingsEnum.nextPosition(AssertingLeafReader.java:353) at org.apache.lucene.search.ExactPhraseScorer.phraseFreq(ExactPhraseScorer.java:132) at org.apache.lucene.search.ExactPhraseScorer.access$000(ExactPhraseScorer.java:27) at org.apache.lucene.search.ExactPhraseScorer$1.matches(ExactPhraseScorer.java:69) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$2.matches(ProfileQuery.java:226) at org.apache.lucene.search.ConjunctionDISI$TwoPhaseConjunctionDISI.matches(ConjunctionDISI.java:175) at org.apache.lucene.search.ConjunctionDISI$TwoPhase.matches(ConjunctionDISI.java:213) at org.apache.lucene.search.ConjunctionDISI.doNext(ConjunctionDISI.java:128) at org.apache.lucene.search.ConjunctionDISI.nextDoc(ConjunctionDISI.java:151) at org.apache.lucene.search.ConjunctionScorer.nextDoc(ConjunctionScorer.java:62) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$1.nextDoc(ProfileQuery.java:205) at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:224) at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:169) at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:795) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:509) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:347) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:111) at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:366) at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:378) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365) at org.elasticsearch.transport.local.LocalTransport$2.doRun(LocalTransport.java:280) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) commit 889fe6383370fe919aaa9f0af398e3040209e40b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:30:38 2015 -0400 [DOCS] More docs commit 89177965d031d84937753538b88ea5ebae2956b0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 09:59:09 2015 -0400 Fix multi-stage rewrites to recursively find most appropriate descendant rewrite Previously, we chose the first rewrite that matched. But in situations where a query may rewrite several times, this won't build the tree correctly. Instead we need to recurse down all the rewrites until we find the most appropriate "leaf" rewrite The implementation of this is kinda gross: we recursively call getRewrittenParentToken(), which does a linear scan over the rewriteMap and tries to find rewrites with a larger token value (since we know child tokens are always larger). Can almost certainly find a better way to do this... commit 0b4d782b5348e5d03fd26f7d91bc4a3fbcb7f6a5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Oct 14 19:30:06 2015 -0400 [Docs] Documentation checkpoint commit 383636453f6610fcfef9070c21ae7ca11346793e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 16:02:22 2015 -0400 Comments commit a81e8f31e681be16e89ceab9ba3c3e0a018f18ef Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 15:48:49 2015 -0400 [TESTS] Ensure all tests use QUERY_THEN_FETCH, DFS does not profile commit 1255c2d790d85fcb9cbb78bf2a53195138c6bc24 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 16:43:46 2015 -0400 Refactor rewrite handling to handle identical rewrites commit 85b7ec82eb0b26a6fe87266b38f5f86f9ac0c44f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:51:14 2015 -0400 Don't update parent when a token is added as root -- Fixes NPE commit 109d02bdbc49741a3b61e8624521669b0968b839 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:50:40 2015 -0400 Don't set the rewritten query if not profiling -- Fixes NPE commit 233cf5e85f6f2c39ed0a2a33d7edd3bbd40856e8 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:04:51 2015 -0400 Update tests to new response format commit a930b1fc19de3a329abc8ffddc6711c1246a4b15 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:03:58 2015 -0400 Fix serialization commit 69afdd303660510c597df9bada5531b19d134f3d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 15:11:31 2015 -0400 Comments and cleanup commit 64e7ca7f78187875378382ec5d5aa2462ff71df5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 14:40:21 2015 -0400 Move timing into dedicated class, add proper rewrite integration commit b44ff85ddbba0a080e65f2e7cc8c50d30e95df8e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 12:00:38 2015 -0400 Checkpoint - Refactoring to use a token-based dependency tree commit 52cedd5266d6a87445c6a4cff3be8ff2087cd1b7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Sep 4 19:18:19 2015 -0400 Need to set context profiling flag before calling queryPhase.preProcess commit c524670cb1ce29b4b3a531fa2bff0c403b756f46 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 18:00:37 2015 +0200 Reduce profiling overhead a bit. This removes hash-table lookups everytime we start/stop a profiling clock. commit 111444ff8418737082236492b37321fc96041e09 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:18:59 2015 +0200 Add profiling of two-phase iterators. This is useful for eg. phrase queries or script filters, since they are typically consumed through their two-phase iterator instead of the scorer. commit f275e690459e73211bc8494c6de595c0320f4c0b Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:03:21 2015 +0200 Some more improvements. I changed profiling to disable bulk scoring, since it makes it impossible to know where time is spent. Also I removed profiling of operations that are always fast (eg. normalization) and added nextDoc/advance. commit 3c8dcd872744de8fd76ce13b6f18f36f8de44068 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:39:50 2015 +0200 Remove println. commit d68304862fb38a3823aebed35a263bd9e2176c2f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:36:03 2015 +0200 Fix some test failures introduced by the rebase... commit 04d53ca89fb34b7a21515d770c32aaffcc513b90 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 13:57:35 2015 +0200 Reconcile conflicting changes after rebase commit fed03ec8e2989a0678685cd6c50a566cec42ea4f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Aug 20 22:40:39 2015 -0400 Add Collectors to profile results Profile response element has now been re-arranged so that everything is listed per-shard to facilitate grouping elements together. The new `collector` element looks like this: ``` "profile": { "shards": [ { "shard_id": "keP4YFywSXWALCl4m4k24Q", "query": [...], "collector": [ { "name": "MultiCollector", "purpose": "search_multi", "time": "16.44504400ms", "relative_time": "100.0000000%", "children": [ { "name": "FilteredCollector", "purpose": "search_post_filter", "time": "4.556013000ms", "relative_time": "27.70447437%", "children": [ { "name": "SimpleTopScoreDocCollector", "purpose": "search_sorted", "time": "1.352166000ms", "relative_time": "8.222331299%", "children": [] } ] }, { "name": "BucketCollector: [[non_global_term, another_agg]]", "purpose": "aggregation", "time": "10.40379400ms", "relative_time": "63.26400829%", "children": [] }, ... ``` commit 1368b495c934be642c00f6cbf9fc875d7e6c07ff Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Aug 19 12:43:03 2015 -0400 Move InternalProfiler to profile package commit 53584de910db6d4a6bb374c9ebb954f204882996 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 18:34:58 2015 -0400 Only reconcile rewrite timing when rewritten query is different from original commit 9804c3b29d2107cd97f1c7e34d77171b62cb33d0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 16:40:15 2015 -0400 Comments and cleanup commit 8e898cc7c59c0c1cc5ed576dfed8e3034ca0967f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:19:07 2015 -0400 [TESTS] Fix comparison test to ensure results sort identically commit f402a29001933eef29d5a62e81c8563f1c8d0969 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:59 2015 -0400 Add note about DFS being unable to profile commit d446e08d3bc91cd85b24fc908e2d82fc5739d598 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:23 2015 -0400 Implement some missing methods commit 13ca94fb86fb037a30d181b73d9296153a63d6e4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:10:54 2015 -0400 [TESTS] Comments & cleanup commit c76c8c771fdeee807761c25938a642612a6ed8e7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:06:08 2015 -0400 [TESTS] Fix profileMatchesRegular to handle NaN scores and nearlyEqual floats commit 7e7a10ecd26677b2239149468e24938ce5cc18e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:22:16 2015 -0400 Move nearlyEquals() utility function to shared location commit 842222900095df4b27ff3593dbb55a42549f2697 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:04:35 2015 -0400 Fixup rebase conflicts commit 674f162d7704dd2034b8361358decdefce1f76ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:29:35 2015 -0400 [TESTS] Update match and bool tests commit 520380a85456d7137734aed0b06a740e18c9cdec Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:28:09 2015 -0400 Make naming consistent re: plural commit b9221501d839bb24d6db575d08e9bee34043fc65 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:27:39 2015 -0400 Children need to be added to list after serialization commit 05fa51df940c332fbc140517ee56e849f2d40a72 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:22:41 2015 -0400 Re-enable bypass for non-profiled queries commit f132204d264af77a75bd26a02d4e251a19eb411d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:21:14 2015 -0400 Fix serialization of QuerySearchResult, InternalProfileResult commit 27b98fd475fc2e9508c91436ef30624bdbee54ba Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 10 17:39:17 2015 -0400 Start to add back tests, refactor Java api commit bcfc9fefd49307045108408dc160774666510e85 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 4 17:08:10 2015 -0400 Checkpoint commit 26a530e0101ce252450eb23e746e48c2fd1bfcae Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Jul 14 13:30:32 2015 -0400 Add createWeight() checkpoint commit f0dd61de809c5c13682aa213c0be65972537a0df Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Jul 13 12:36:27 2015 -0400 checkpoint commit 377ee8ce5729b8d388c4719913b48fae77a16686 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Mar 18 10:45:01 2015 -0400 checkpoint
2015-12-17 12:05:43 -05:00
import org.elasticsearch.search.profile.Profilers;
2015-12-18 12:43:47 -08:00
import org.elasticsearch.search.query.QueryPhaseExecutionException;
import org.elasticsearch.search.query.QuerySearchResult;
import org.elasticsearch.search.rescore.RescoreContext;
import org.elasticsearch.search.slice.SliceBuilder;
import org.elasticsearch.search.sort.SortAndFormats;
import org.elasticsearch.search.suggest.SuggestionSearchContext;
import java.io.IOException;
import java.io.UncheckedIOException;
2015-12-18 12:43:47 -08:00
import java.util.ArrayList;
import java.util.Arrays;
2015-12-18 12:43:47 -08:00
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.LongSupplier;
final class DefaultSearchContext extends SearchContext {
private final SearchContextId id;
private final ShardSearchRequest request;
private final SearchShardTarget shardTarget;
private final LongSupplier relativeTimeSupplier;
private SearchType searchType;
private final Engine.Searcher engineSearcher;
private final BigArrays bigArrays;
private final IndexShard indexShard;
private final ClusterService clusterService;
private final IndexService indexService;
private final ContextIndexSearcher searcher;
private final DfsSearchResult dfsResult;
private final QuerySearchResult queryResult;
private final FetchSearchResult fetchResult;
private final float queryBoost;
private final boolean lowLevelCancellation;
private TimeValue timeout;
// terminate after count
private int terminateAfter = DEFAULT_TERMINATE_AFTER;
private List<String> groupStats;
private ScrollContext scrollContext;
private boolean explain;
private boolean version = false; // by default, we don't return versions
private boolean seqAndPrimaryTerm = false;
private StoredFieldsContext storedFields;
private ScriptFieldsContext scriptFields;
private FetchSourceContext fetchSourceContext;
private FetchDocValuesContext docValuesContext;
private FetchFieldsContext fetchFieldsContext;
private int from = -1;
private int size = -1;
private SortAndFormats sort;
private Float minimumScore;
private boolean trackScores = false; // when sorting, track scores as well...
private int trackTotalHitsUpTo = SearchContext.DEFAULT_TRACK_TOTAL_HITS_UP_TO;
private FieldDoc searchAfter;
private CollapseContext collapse;
// filter for sliced scroll
private SliceBuilder sliceBuilder;
private SearchShardTask task;
private final Version minNodeVersion;
/**
* The original query as sent by the user without the types and aliases
* applied. Putting things in here leaks them into highlighting so don't add
* things like the type filter or alias filters.
*/
private ParsedQuery originalQuery;
/**
* The query to actually execute.
*/
private Query query;
private ParsedQuery postFilter;
private Query aliasFilter;
private int[] docIdsToLoad;
private int docsIdsToLoadFrom;
private int docsIdsToLoadSize;
private SearchContextAggregations aggregations;
private SearchHighlightContext highlight;
private SuggestionSearchContext suggest;
private List<RescoreContext> rescore;
private volatile long keepAlive;
private final long originNanoTime = System.nanoTime();
private volatile long lastAccessTime = -1;
Add ability to profile query and collectors Provides a new flag which can be enabled on a per-request basis. When `"profile": true` is set, the search request will execute in a mode that collects detailed timing information for query components. ``` GET /test/test/_search { "profile": true, "query": { "match": { "foo": "bar" } } } ``` Closes #14889 Squashed commit of the following: commit a92db5723d2c61b8449bd163d2f006d12f9889ad Merge: 117dd99 3f87b08 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 17 09:44:10 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 117dd9992e8014b70203c6110925643769d80e62 Merge: 9b29d68 82a64fd Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Dec 15 13:27:18 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler Conflicts: core/src/main/java/org/elasticsearch/search/SearchService.java commit 9b29d6823a71140ecd872df25ff9f7478e7fe766 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 16:13:23 2015 -0500 [TEST] Profile flag needs to be set, ensure searches go against primary only for consistency commit 4d602d8ad1f8cbc7b475450921fa3bc7d395b34f Merge: 8b48e87 7742c1e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:25 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 8b48e876348b163ab730eeca7fa35142165b05f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:01 2015 -0500 Delegate straight to in.matchCost, no need for profiling commit fde3b0587911f0b5f15e779c671d0510cbd568a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:28:23 2015 -0500 Documentation tweaks, renaming build_weight -> create_weight commit 46f5e011ee23fe9bb8a1f11ceb4fa9d19fe48e2e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:27:52 2015 -0500 Profile TwoPhaseIterator should override matchCost() commit b59f894ddb11b2a7beebba06c4ec5583ff91a7b2 Merge: 9aa1a3a b4e0c87 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 14:23:26 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 9aa1a3a25c34c9cd9fffaa6114c25a0ec791307d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:48 2015 -0500 Revert "Move some of the collector wrapping logic into ProfileCollectorBuilder" This reverts commit 02cc31767fb76a7ecd44a302435e93a05fb4220e. commit 57f7c04cea66b3f98ba2bec4879b98e4fba0b3c0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:31 2015 -0500 Revert "Rearrange if/else to make intent clearer" This reverts commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00. commit 2874791b9c9cd807113e75e38be465f3785c154e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:38:13 2015 -0500 Revert "Move state into ProfileCollectorBuilder" This reverts commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6. commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 3 11:21:55 2015 -0500 Move state into ProfileCollectorBuilder commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:21:12 2015 -0500 Rearrange if/else to make intent clearer commit 511db0af2f3a86328028b88a6b25fa3dfbab963b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:12:06 2015 -0500 Rename WEIGHT -> BUILD_WEIGHT commit 02cc31767fb76a7ecd44a302435e93a05fb4220e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:11:22 2015 -0500 Move some of the collector wrapping logic into ProfileCollectorBuilder commit e69356d3cb4c60fa281dad36d84faa64f5c32bc4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:12:35 2015 -0500 Cleanup imports commit c1b4f284f16712be60cd881f7e4a3e8175667d62 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:11:25 2015 -0500 Review cleanup: Make InternalProfileShardResults writeable commit 9e61c72f7e1787540f511777050a572b7d297636 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:01:22 2015 -0500 Review cleanup: Merge ProfileShardResult, InternalProfileShardResult. Convert to writeable commit 709184e1554f567c645690250131afe8568a5799 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:38:08 2015 -0500 Review cleanup: Merge ProfileResult, InternalProfileResult. Convert to writeable commit 7d72690c44f626c34e9c608754bc7843dd7fd8fe Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:01:34 2015 -0500 Review cleanup: use primitive (and default) for profile flag commit 97d557388541bbd3388cdcce7d9718914d88de6d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:09:12 2015 -0500 Review cleanup: Use Collections.emptyMap() instead of building an empty one explicitly commit 219585b8729a8b0982e653d99eb959efd0bef84e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:08:12 2015 -0500 Add todo to revisit profiler architecture in the future commit b712edb2160e032ee4b2f2630fadf131a0936886 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:05:32 2015 -0500 Split collector serialization from timing, use writeable instead of streamable Previously, the collector timing was done in the same class that was serialized, which required leaving the collector null when serializing. Besides being a bit gross, this made it difficult to change the class to Writeable. This splits up the timing (InternalProfileCollector + ProfileCollector) and the serialization of the times (CollectorResult). CollectorResult is writeable, and also acts as the public interface. commit 6ddd77d066262d4400e3d338b11cebe7dd27ca78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 13:15:12 2015 -0500 Remove dead code commit 06033f8a056e2121d157654a65895c82bbe93a51 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 12:49:51 2015 -0500 Review cleanup: Delegate to in.getProfilers() Note: Need to investigate how this is used exactly so we can add a test, it isn't touched by a normal inner_hits query... commit a77e13da21b4bad1176ca2b5d5b76034fb12802f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:59:58 2015 -0500 Review cleanup: collapse to single `if` statement commit e97bb6215a5ebb508b0293ac3acd60d5ae479be1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:39:43 2015 -0500 Review cleanup: Return empty map instead of null for profile results Note: we still need to check for nullness in SearchPhaseController, since an empty/no-hits result won't have profiling instantiated (or any other component like aggs or suggest). Therefore QuerySearchResult.profileResults() is still @Nullable commit db8e691de2a727389378b459fa76c942572e6015 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 10:14:47 2015 -0500 Review cleanup: renaming, formatting fixes, assertions commit 9011775fe80ba22c2fd948ca64df634b4e32772d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:09:52 2015 -0500 [DOCS] Add missing annotation commit 4b58560b06f08d4b99b149af20916ee839baabd7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:07:17 2015 -0500 [DOCS] Update documentation for new format commit f0458c58e5538ed8ec94849d4baf3250aa9ec841 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:14:09 2015 +0100 Reduce visibility of internal classes. commit d0a7d319098e60b028fa772bf8a99b2df9cf6146 Merge: e158070 1bdf29e Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:09:18 2015 +0100 Merge branch 'master' into query_profiler commit e158070a48cb096551f3bb3ecdcf2b53bbc5e3c5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:08:48 2015 +0100 Fix compile error due to bad html in javadocs. commit a566b5d08d659daccb087a9afbe908ec3d96cd6e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:37 2015 -0500 Remove unused collector commit 4060cd72d150cc68573dbde62ca7321c47f75703 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:10 2015 -0500 Comment cleanup commit 43137952bf74728f5f5d5a8d1bfc073e0f9fe4f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:32:06 2015 -0500 Fix negative formatted time commit 5ef3a980266326aff12d4fe380f73455ff28209f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 17:10:17 2015 +0100 Fix javadocs. commit 276114d29e4b17a0cc0982cfff51434f712dc59e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 16:25:23 2015 +0100 Fix: include rewrite time as well... commit 21d9e17d05487bf4903ae3d2ab6f429bece2ffef Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 15:10:15 2015 +0100 Remove TODO about profiling explain. commit 105a31e8e570efb879447159c3852871f5cf7db4 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:59:30 2015 +0100 Fix nocommit now that the global collector is a root collector. commit 2e8fc5cf84adb1bfaba296808c329e5f982c9635 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:53:38 2015 +0100 Make collector wrapping more explicit/robust (and a bit less magical). commit 5e30b570b0835e1ce79a57933a31b6a2d0d58e2d Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 12:44:03 2015 +0100 Simplify recording API a bit. commit 9b453afced6adc0a59ca1d67d90c28796b105185 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:54:25 2015 +0100 Fix serialization-related nocommits. commit ad97b200bb123d4e9255e7c8e02f7e43804057a5 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:46:30 2015 +0100 Fix DFS. commit a6de06986cd348a831bd45e4f524d2e14d9e03c3 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:29:16 2015 +0100 Remove forbidden @Test annotation. commit 4991a28e19501109af98026e14756cb25a56f4f4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:25:59 2015 +0100 Limit the impact of query profiling on the SearchContext API. Rule is: we can put as much as we want in the search.profile package but should aim at touching as little as possible other areas of the code base. commit 353d8d75a5ce04d9c3908a0a63d4ca6e884c519a Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 18:05:09 2015 +0100 Remove dead code. commit a3ffafb5ddbb5a2acf43403c946e5ed128f47528 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:35 2015 +0100 Remove call to forbidden String.toLowerCase() API. commit 1fa8c7a00324fa4e32bd24135ebba5ecf07606f1 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:27 2015 +0100 Fix compilation. commit 2067f1797e53bef0e1a8c9268956bc5fb8f8ad97 Merge: 22e631f fac472f Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:21:12 2015 +0100 Merge branch 'master' into query_profiler commit 22e631fe6471fed19236578e97c628d5cda401a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:52:05 2015 -0500 Fix and simplify serialization of shard profile results commit 461da250809451cd2b47daf647343afbb4b327f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:32:22 2015 -0500 Remove helper methods, simpler without them commit 5687aa1c93d45416d895c2eecc0e6a6b302139f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:29:32 2015 -0500 [TESTS] Fix tests for new rewrite format commit ba9e82857fc6d4c7b72ef4d962d2102459365299 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 30 15:28:14 2015 -0400 Rewrites begone! Record all rewrites as a single time metric commit 5f28d7cdff9ee736651d564f71f713bf45fb1d91 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:36:06 2015 -0400 Merge duplicate rewrites into one entry By using the Query as the key in a map, we can easily merge rewrites together. This means the preProcess(), assertion and main query rewrites all get merged together. Downside is that rewrites of the same Query (hashcode) but in different places get lumped together. I think the simplicity of the solution is better than the slight loss in output fidelity. commit 9a601ea46bb21052746157a45dcc6de6bc350e9c Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:28:27 2015 -0400 Allow multiple "searches" per profile (e.g. query + global agg) commit ee30217328381cd83f9e653d3a4d870c1d2bdfce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:29:18 2015 -0400 Update comment, add nullable annotation commit 405c6463a64e118f170959827931e8c6a1661f13 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:04:30 2015 -0400 remove out-dated comment commit 2819ae8f4cf1bfd5670dbd1c0e06195ae457b58f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:47 2015 +0100 Don't render children in the profiles when there are no children. commit 7677c2ddefef321bbe74660471603d202a4ab66f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:35 2015 +0100 Set the profiler on the ContextIndexSearcher. commit 74a4338c35dfed779adc025ec17cfd4d1c9f66f5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:01 2015 +0100 Fix json rendering. commit 6674d5bebe187b0b0d8b424797606fdf2617dd27 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:20:19 2015 +0100 Revert "nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called" This reverts commit d3dc10949024342055f0d4fb7e16c7a43423bfab. commit d3dc10949024342055f0d4fb7e16c7a43423bfab Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 17:20:57 2015 -0400 nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called Previously, it was enabled by using DefaultSearchContext as a third-party "proxy", but since the refactor to make it unit testable, setProfile() needs to be called explicitly. Unfortunately, this is not possible because SearchService only has access to an IndexSearcher. And it is not cast'able to a DefaultIndexSearcher. commit b9ba9c5d1f93b9c45e97b0a4e35da6f472c9ea53 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:27:00 2015 -0400 [TESTS] Fix unit tests commit cf5d1e016b2b4a583175e07c16c7152f167695ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:22:34 2015 -0400 Increment token after recording a rewrite commit b7d08f64034e498533c4a81bff8727dd8ac2843e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:14:09 2015 -0400 Fix NPE if a top-level root doesn't have children commit e4d3b514bafe2a3a9db08438c89f0ed68628f2d6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:47 2015 -0400 Fix NPE when profiling is disabled commit 445384fe48ed62fdd01f7fc9bf3e8361796d9593 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:37 2015 -0400 [TESTS] Fix integration tests commit b478296bb04fece827a169e7522df0a5ea7840a3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 15:43:24 2015 -0400 Move rewrites to their own section, remove reconciliation Big commit because the structural change affected a lot of the wrapping code. Major changes: - Rewrites are now in their own section in the response - Reconciliation is gone...we don't attempt to roll the rewrites into the query tree structure - InternalProfileShardResults (plural) simply holds a Map<String, InternalProfileShardResult> and helps to serialize / ToXContent - InternalProfileShardResult (singular) is now the holder for all shard-level profiling details. Currently this includes query, collectors and rewrite. In the future it would hold suggest, aggs, etc - When the user requests the profiled results, they get back a Map<String, ProfileShardResult> instead of doing silly helper methods to convert to maps, etc - Shard details are baked into a string instead of serializing the object commit 24819ad094b208d0e94f17ce9c3f7c92f7414124 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 10:25:38 2015 -0400 Make Profile results immutable by removing relative_time commit bfaf095f45fed74194ef78160a8e5dcae1850f9e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:54:59 2015 +0200 Add nocommits. commit e9a128d0d26d5b383b52135ca886f2c987850179 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:39:37 2015 +0200 Move all profile-related classes to the same package. commit f20b7c7fdf85384ecc37701bb65310fb8c20844f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:33:14 2015 +0200 Reorganize code a bit to ease unit testing of ProfileCollector. commit 3261306edad6a0c70f59eaee8fe58560f61a75fd Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:07:28 2015 +0200 Remove irrelevant nocommit. commit a6ac868dad12a2e17929878681f66dbd0948d322 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:06:45 2015 +0200 Make CollectorResult's reason a free-text field to ease bw compat. commit 5d0bf170781a950d08b81871cd1e403e49f3cc12 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 16:50:52 2015 +0200 Add unit tests for ProfileWeight/ProfileScorer. commit 2cd88c412c6e62252504ef69a59216adbb574ce4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:55:17 2015 +0200 Rename InternalQueryProfiler to Profiler. commit 84f5718fa6779f710da129d9e0e6ff914fd85e36 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:53:58 2015 +0200 Merge InternalProfileBreakdown into ProfileBreakdown. commit 135168eaeb8999c8117ea25288104b0961ce9b35 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 13:56:57 2015 +0200 Make it possible to instantiate a ContextIndexSearcher without SearchContext. commit 5493fb52376b48460c4ce2dedbe00cc5f6620499 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:53:29 2015 +0200 Move ProfileWeight/Scorer to their own files. commit bf2d917b9dae3b32dfc29c35a7cac4ccb7556cce Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:38:24 2015 +0200 Fix bug that caused phrase queries to fail. commit b2bb0c92c343334ec1703a221af24a1b55e36d53 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:36:17 2015 +0200 Parsing happens on the coordinating node now. commit 416cabb8621acb5cd8dfa77374fd23e428f52fe9 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:22:17 2015 +0200 Fix compilation (in particular remove guava deps). commit f996508645f842629d403fc2e71c1890c0e2cac9 Merge: 4616a25 bc3b91e Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 10:44:38 2015 +0200 Merge branch 'master' into query_profiler commit 4616a25afffe9c24c6531028f7fccca4303d2893 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:32 2015 -0400 Make Java Count API compatible with profiling commit cbfba74e16083d719722500ac226efdb5cb2ff55 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:19 2015 -0400 Fix serialization of profile query param, NPE commit e33ffac383b03247046913da78c8a27e457fae78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 11:17:48 2015 -0400 TestSearchContext should return null Profiler instead of exception commit 73a02d69b466dc1a5b8a5f022464d6c99e6c2ac3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:07:29 2015 -0400 [DOCS] Update docs to reflect new ID format commit 36248e388c354f954349ecd498db7b66f84ce813 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:03:03 2015 -0400 Use the full [node][index][shard] string as profile result ID commit 5cfcc4a6a6b0bcd6ebaa7c8a2d0acc32529a80e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:51:40 2015 -0400 Add failing test for phrase matching Stack trace generated: [2015-10-15 17:50:54,438][ERROR][org.elasticsearch.search.profile] shard [[JNj7RX_oSJikcnX72aGBoA][test][2]], reason [RemoteTransportException[[node_s0][local[1]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: AssertionError[nextPosition() called more than freq() times!]; ], cause [java.lang.AssertionError: nextPosition() called more than freq() times! at org.apache.lucene.index.AssertingLeafReader$AssertingPostingsEnum.nextPosition(AssertingLeafReader.java:353) at org.apache.lucene.search.ExactPhraseScorer.phraseFreq(ExactPhraseScorer.java:132) at org.apache.lucene.search.ExactPhraseScorer.access$000(ExactPhraseScorer.java:27) at org.apache.lucene.search.ExactPhraseScorer$1.matches(ExactPhraseScorer.java:69) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$2.matches(ProfileQuery.java:226) at org.apache.lucene.search.ConjunctionDISI$TwoPhaseConjunctionDISI.matches(ConjunctionDISI.java:175) at org.apache.lucene.search.ConjunctionDISI$TwoPhase.matches(ConjunctionDISI.java:213) at org.apache.lucene.search.ConjunctionDISI.doNext(ConjunctionDISI.java:128) at org.apache.lucene.search.ConjunctionDISI.nextDoc(ConjunctionDISI.java:151) at org.apache.lucene.search.ConjunctionScorer.nextDoc(ConjunctionScorer.java:62) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$1.nextDoc(ProfileQuery.java:205) at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:224) at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:169) at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:795) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:509) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:347) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:111) at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:366) at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:378) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365) at org.elasticsearch.transport.local.LocalTransport$2.doRun(LocalTransport.java:280) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) commit 889fe6383370fe919aaa9f0af398e3040209e40b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:30:38 2015 -0400 [DOCS] More docs commit 89177965d031d84937753538b88ea5ebae2956b0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 09:59:09 2015 -0400 Fix multi-stage rewrites to recursively find most appropriate descendant rewrite Previously, we chose the first rewrite that matched. But in situations where a query may rewrite several times, this won't build the tree correctly. Instead we need to recurse down all the rewrites until we find the most appropriate "leaf" rewrite The implementation of this is kinda gross: we recursively call getRewrittenParentToken(), which does a linear scan over the rewriteMap and tries to find rewrites with a larger token value (since we know child tokens are always larger). Can almost certainly find a better way to do this... commit 0b4d782b5348e5d03fd26f7d91bc4a3fbcb7f6a5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Oct 14 19:30:06 2015 -0400 [Docs] Documentation checkpoint commit 383636453f6610fcfef9070c21ae7ca11346793e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 16:02:22 2015 -0400 Comments commit a81e8f31e681be16e89ceab9ba3c3e0a018f18ef Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 15:48:49 2015 -0400 [TESTS] Ensure all tests use QUERY_THEN_FETCH, DFS does not profile commit 1255c2d790d85fcb9cbb78bf2a53195138c6bc24 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 16:43:46 2015 -0400 Refactor rewrite handling to handle identical rewrites commit 85b7ec82eb0b26a6fe87266b38f5f86f9ac0c44f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:51:14 2015 -0400 Don't update parent when a token is added as root -- Fixes NPE commit 109d02bdbc49741a3b61e8624521669b0968b839 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:50:40 2015 -0400 Don't set the rewritten query if not profiling -- Fixes NPE commit 233cf5e85f6f2c39ed0a2a33d7edd3bbd40856e8 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:04:51 2015 -0400 Update tests to new response format commit a930b1fc19de3a329abc8ffddc6711c1246a4b15 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:03:58 2015 -0400 Fix serialization commit 69afdd303660510c597df9bada5531b19d134f3d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 15:11:31 2015 -0400 Comments and cleanup commit 64e7ca7f78187875378382ec5d5aa2462ff71df5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 14:40:21 2015 -0400 Move timing into dedicated class, add proper rewrite integration commit b44ff85ddbba0a080e65f2e7cc8c50d30e95df8e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 12:00:38 2015 -0400 Checkpoint - Refactoring to use a token-based dependency tree commit 52cedd5266d6a87445c6a4cff3be8ff2087cd1b7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Sep 4 19:18:19 2015 -0400 Need to set context profiling flag before calling queryPhase.preProcess commit c524670cb1ce29b4b3a531fa2bff0c403b756f46 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 18:00:37 2015 +0200 Reduce profiling overhead a bit. This removes hash-table lookups everytime we start/stop a profiling clock. commit 111444ff8418737082236492b37321fc96041e09 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:18:59 2015 +0200 Add profiling of two-phase iterators. This is useful for eg. phrase queries or script filters, since they are typically consumed through their two-phase iterator instead of the scorer. commit f275e690459e73211bc8494c6de595c0320f4c0b Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:03:21 2015 +0200 Some more improvements. I changed profiling to disable bulk scoring, since it makes it impossible to know where time is spent. Also I removed profiling of operations that are always fast (eg. normalization) and added nextDoc/advance. commit 3c8dcd872744de8fd76ce13b6f18f36f8de44068 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:39:50 2015 +0200 Remove println. commit d68304862fb38a3823aebed35a263bd9e2176c2f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:36:03 2015 +0200 Fix some test failures introduced by the rebase... commit 04d53ca89fb34b7a21515d770c32aaffcc513b90 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 13:57:35 2015 +0200 Reconcile conflicting changes after rebase commit fed03ec8e2989a0678685cd6c50a566cec42ea4f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Aug 20 22:40:39 2015 -0400 Add Collectors to profile results Profile response element has now been re-arranged so that everything is listed per-shard to facilitate grouping elements together. The new `collector` element looks like this: ``` "profile": { "shards": [ { "shard_id": "keP4YFywSXWALCl4m4k24Q", "query": [...], "collector": [ { "name": "MultiCollector", "purpose": "search_multi", "time": "16.44504400ms", "relative_time": "100.0000000%", "children": [ { "name": "FilteredCollector", "purpose": "search_post_filter", "time": "4.556013000ms", "relative_time": "27.70447437%", "children": [ { "name": "SimpleTopScoreDocCollector", "purpose": "search_sorted", "time": "1.352166000ms", "relative_time": "8.222331299%", "children": [] } ] }, { "name": "BucketCollector: [[non_global_term, another_agg]]", "purpose": "aggregation", "time": "10.40379400ms", "relative_time": "63.26400829%", "children": [] }, ... ``` commit 1368b495c934be642c00f6cbf9fc875d7e6c07ff Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Aug 19 12:43:03 2015 -0400 Move InternalProfiler to profile package commit 53584de910db6d4a6bb374c9ebb954f204882996 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 18:34:58 2015 -0400 Only reconcile rewrite timing when rewritten query is different from original commit 9804c3b29d2107cd97f1c7e34d77171b62cb33d0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 16:40:15 2015 -0400 Comments and cleanup commit 8e898cc7c59c0c1cc5ed576dfed8e3034ca0967f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:19:07 2015 -0400 [TESTS] Fix comparison test to ensure results sort identically commit f402a29001933eef29d5a62e81c8563f1c8d0969 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:59 2015 -0400 Add note about DFS being unable to profile commit d446e08d3bc91cd85b24fc908e2d82fc5739d598 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:23 2015 -0400 Implement some missing methods commit 13ca94fb86fb037a30d181b73d9296153a63d6e4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:10:54 2015 -0400 [TESTS] Comments & cleanup commit c76c8c771fdeee807761c25938a642612a6ed8e7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:06:08 2015 -0400 [TESTS] Fix profileMatchesRegular to handle NaN scores and nearlyEqual floats commit 7e7a10ecd26677b2239149468e24938ce5cc18e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:22:16 2015 -0400 Move nearlyEquals() utility function to shared location commit 842222900095df4b27ff3593dbb55a42549f2697 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:04:35 2015 -0400 Fixup rebase conflicts commit 674f162d7704dd2034b8361358decdefce1f76ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:29:35 2015 -0400 [TESTS] Update match and bool tests commit 520380a85456d7137734aed0b06a740e18c9cdec Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:28:09 2015 -0400 Make naming consistent re: plural commit b9221501d839bb24d6db575d08e9bee34043fc65 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:27:39 2015 -0400 Children need to be added to list after serialization commit 05fa51df940c332fbc140517ee56e849f2d40a72 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:22:41 2015 -0400 Re-enable bypass for non-profiled queries commit f132204d264af77a75bd26a02d4e251a19eb411d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:21:14 2015 -0400 Fix serialization of QuerySearchResult, InternalProfileResult commit 27b98fd475fc2e9508c91436ef30624bdbee54ba Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 10 17:39:17 2015 -0400 Start to add back tests, refactor Java api commit bcfc9fefd49307045108408dc160774666510e85 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 4 17:08:10 2015 -0400 Checkpoint commit 26a530e0101ce252450eb23e746e48c2fd1bfcae Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Jul 14 13:30:32 2015 -0400 Add createWeight() checkpoint commit f0dd61de809c5c13682aa213c0be65972537a0df Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Jul 13 12:36:27 2015 -0400 checkpoint commit 377ee8ce5729b8d388c4719913b48fae77a16686 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Mar 18 10:45:01 2015 -0400 checkpoint
2015-12-17 12:05:43 -05:00
private Profilers profilers;
private final Map<String, SearchExtBuilder> searchExtBuilders = new HashMap<>();
private final Map<Class<?>, Collector> queryCollectors = new HashMap<>();
private final QueryShardContext queryShardContext;
private final FetchPhase fetchPhase;
2015-07-22 17:16:15 +02:00
DefaultSearchContext(SearchContextId id, ShardSearchRequest request, SearchShardTarget shardTarget,
Engine.Searcher engineSearcher, ClusterService clusterService, IndexService indexService,
IndexShard indexShard, BigArrays bigArrays, LongSupplier relativeTimeSupplier, TimeValue timeout,
FetchPhase fetchPhase, boolean lowLevelCancellation, Version minNodeVersion) throws IOException {
this.id = id;
this.request = request;
this.fetchPhase = fetchPhase;
this.searchType = request.searchType();
this.shardTarget = shardTarget;
this.engineSearcher = engineSearcher;
Add HierarchyCircuitBreakerService Adds a breaker for request BigArrays, which are used for parent/child queries as well as some aggregations. Certain operations like Netty HTTP responses and transport responses increment the breaker, but will not trip. This also changes the output of the nodes' stats endpoint to show the parent breaker as well as the fielddata and request breakers. There are a number of new settings for breakers now: `indices.breaker.total.limit`: starting limit for all memory-use breaker, defaults to 70% `indices.breaker.fielddata.limit`: starting limit for fielddata breaker, defaults to 60% `indices.breaker.fielddata.overhead`: overhead for fielddata breaker estimations, defaults to 1.03 (the fielddata breaker settings also use the backwards-compatible setting `indices.fielddata.breaker.limit` and `indices.fielddata.breaker.overhead`) `indices.breaker.request.limit`: starting limit for request breaker, defaults to 40% `indices.breaker.request.overhead`: request breaker estimation overhead, defaults to 1.0 The breaker service infrastructure is now generic and opens the path to adding additional circuit breakers in the future. Fixes #6129 Conflicts: src/main/java/org/elasticsearch/index/fielddata/IndexFieldData.java src/main/java/org/elasticsearch/index/fielddata/IndexFieldDataService.java src/main/java/org/elasticsearch/index/fielddata/RamAccountingTermsEnum.java src/main/java/org/elasticsearch/index/fielddata/ordinals/GlobalOrdinalsBuilder.java src/main/java/org/elasticsearch/index/fielddata/ordinals/InternalGlobalOrdinalsBuilder.java src/main/java/org/elasticsearch/index/fielddata/plain/AbstractIndexOrdinalsFieldData.java src/main/java/org/elasticsearch/index/fielddata/plain/DisabledIndexFieldData.java src/main/java/org/elasticsearch/index/fielddata/plain/IndexIndexFieldData.java src/main/java/org/elasticsearch/index/fielddata/plain/NonEstimatingEstimator.java src/main/java/org/elasticsearch/index/fielddata/plain/PackedArrayIndexFieldData.java src/main/java/org/elasticsearch/index/fielddata/plain/ParentChildIndexFieldData.java src/main/java/org/elasticsearch/index/fielddata/plain/SortedSetDVOrdinalsIndexFieldData.java src/main/java/org/elasticsearch/node/internal/InternalNode.java src/test/java/org/elasticsearch/index/aliases/IndexAliasesServiceTests.java src/test/java/org/elasticsearch/index/codec/CodecTests.java src/test/java/org/elasticsearch/index/fielddata/AbstractFieldDataTests.java src/test/java/org/elasticsearch/index/fielddata/IndexFieldDataServiceTests.java src/test/java/org/elasticsearch/index/mapper/MapperTestUtils.java src/test/java/org/elasticsearch/index/query/IndexQueryParserFilterCachingTests.java src/test/java/org/elasticsearch/index/query/SimpleIndexQueryParserTests.java src/test/java/org/elasticsearch/index/query/guice/IndexQueryParserModuleTests.java src/test/java/org/elasticsearch/index/search/FieldDataTermsFilterTests.java src/test/java/org/elasticsearch/index/search/child/ChildrenConstantScoreQueryTests.java src/test/java/org/elasticsearch/index/similarity/SimilarityTests.java
2014-05-21 13:37:03 +02:00
// SearchContexts use a BigArrays that can circuit break
this.bigArrays = bigArrays.withCircuitBreaking();
this.dfsResult = new DfsSearchResult(id, shardTarget);
this.queryResult = new QuerySearchResult(id, shardTarget);
this.fetchResult = new FetchSearchResult(id, shardTarget);
this.indexShard = indexShard;
this.indexService = indexService;
this.clusterService = clusterService;
this.searcher = new ContextIndexSearcher(engineSearcher.getIndexReader(), engineSearcher.getSimilarity(),
engineSearcher.getQueryCache(), engineSearcher.getQueryCachingPolicy(), lowLevelCancellation);
this.relativeTimeSupplier = relativeTimeSupplier;
this.timeout = timeout;
this.minNodeVersion = minNodeVersion;
queryShardContext = indexService.newQueryShardContext(request.shardId().id(), searcher,
request::nowInMillis, shardTarget.getClusterAlias());
queryShardContext.setTypes(request.types());
queryBoost = request.indexBoost();
this.lowLevelCancellation = lowLevelCancellation;
}
@Override
public void doClose() {
Releasables.close(engineSearcher);
}
/**
* Should be called before executing the main query and after all other parameters have been set.
*/
@Override
public void preProcess(boolean rewrite) {
if (hasOnlySuggest() ) {
return;
}
long from = from() == -1 ? 0 : from();
long size = size() == -1 ? 10 : size();
long resultWindow = from + size;
int maxResultWindow = indexService.getIndexSettings().getMaxResultWindow();
if (resultWindow > maxResultWindow) {
if (scrollContext == null) {
throw new IllegalArgumentException(
"Result window is too large, from + size must be less than or equal to: [" + maxResultWindow + "] but was ["
+ resultWindow + "]. See the scroll api for a more efficient way to request large data sets. "
2016-01-14 15:21:59 +01:00
+ "This limit can be set by changing the [" + IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey()
+ "] index level setting.");
}
throw new IllegalArgumentException(
"Batch size is too large, size must be less than or equal to: [" + maxResultWindow + "] but was [" + resultWindow
+ "]. Scroll batch sizes cost as much memory as result windows so they are controlled by the ["
+ IndexSettings.MAX_RESULT_WINDOW_SETTING.getKey() + "] index level setting.");
}
if (rescore != null) {
if (sort != null) {
throw new IllegalArgumentException("Cannot use [sort] option in conjunction with [rescore].");
}
int maxWindow = indexService.getIndexSettings().getMaxRescoreWindow();
for (RescoreContext rescoreContext: rescore) {
if (rescoreContext.getWindowSize() > maxWindow) {
throw new IllegalArgumentException("Rescore window [" + rescoreContext.getWindowSize() + "] is too large. "
+ "It must be less than [" + maxWindow + "]. This prevents allocating massive heaps for storing the results "
+ "to be rescored. This limit can be set by changing the [" + IndexSettings.MAX_RESCORE_WINDOW_SETTING.getKey()
+ "] index level setting.");
}
}
}
if (sliceBuilder != null) {
int sliceLimit = indexService.getIndexSettings().getMaxSlicesPerScroll();
int numSlices = sliceBuilder.getMax();
if (numSlices > sliceLimit) {
throw new IllegalArgumentException("The number of slices [" + numSlices + "] is too large. It must "
+ "be less than [" + sliceLimit + "]. This limit can be set by changing the [" +
IndexSettings.MAX_SLICES_PER_SCROLL.getKey() + "] index level setting.");
}
}
// initialize the filtering alias based on the provided filters
try {
final QueryBuilder queryBuilder = request.getAliasFilter().getQueryBuilder();
aliasFilter = queryBuilder == null ? null : queryBuilder.toQuery(queryShardContext);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
if (query() == null) {
parsedQuery(ParsedQuery.parsedMatchAllQuery());
}
if (queryBoost() != AbstractQueryBuilder.DEFAULT_BOOST) {
parsedQuery(new ParsedQuery(new BoostQuery(query(), queryBoost), parsedQuery()));
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
this.query = buildFilteredQuery(query);
if (rewrite) {
try {
this.query = searcher.rewrite(query);
} catch (IOException e) {
throw new QueryPhaseExecutionException(shardTarget, "Failed to rewrite main query", e);
}
}
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
@Override
public Query buildFilteredQuery(Query query) {
List<Query> filters = new ArrayList<>();
Query typeFilter = createTypeFilter(queryShardContext.getTypes());
if (typeFilter != null) {
filters.add(typeFilter);
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
if (mapperService().hasNested()
&& typeFilter == null // when a _type filter is set, it will automatically exclude nested docs
&& new NestedHelper(mapperService()).mightMatchNestedDocs(query)
&& (aliasFilter == null || new NestedHelper(mapperService()).mightMatchNestedDocs(aliasFilter))) {
filters.add(Queries.newNonNestedFilter(mapperService().getIndexSettings().getIndexVersionCreated()));
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
if (aliasFilter != null) {
filters.add(aliasFilter);
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
if (sliceBuilder != null) {
Query slicedQuery = sliceBuilder.toFilter(clusterService, request, queryShardContext, minNodeVersion);
if (slicedQuery instanceof MatchNoDocsQuery) {
return slicedQuery;
} else {
filters.add(slicedQuery);
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
}
if (filters.isEmpty()) {
return query;
} else {
BooleanQuery.Builder builder = new BooleanQuery.Builder();
builder.add(query, Occur.MUST);
for (Query filter : filters) {
builder.add(filter, Occur.FILTER);
}
return builder.build();
}
}
private Query createTypeFilter(String[] types) {
if (types != null && types.length >= 1) {
MappedFieldType ft = mapperService().fieldType(TypeFieldMapper.NAME);
if (ft != null) {
// ft might be null if no documents have been indexed yet
return ft.termsQuery(Arrays.asList(types), queryShardContext);
}
}
Nested queries should avoid adding unnecessary filters when possible. (#23079) When nested objects are present in the mappings, many queries get deoptimized due to the need to exclude documents that are not in the right space. For instance, a filter is applied to all queries that prevents them from matching non-root documents (`+*:* -_type:__*`). Moreover, a filter is applied to all child queries of `nested` queries in order to make sure that the child query only matches child documents (`_type:__nested_path`), which is required by `ToParentBlockJoinQuery` (the Lucene query behing Elasticsearch's `nested` queries). These additional filters slow down `nested` queries. In 1.7-, the cost was somehow amortized by the fact that we cached filters very aggressively. However, this has proven to be a significant source of slow downs since 2.0 for users of `nested` mappings and queries, see #20797. This change makes the filtering a bit smarter. For instance if the query is a `match_all` query, then we need to exclude nested docs. However, if the query is `foo: bar` then it may only match root documents since `foo` is a top-level field, so no additional filtering is required. Another improvement is to use a `FILTER` clause on all types rather than a `MUST_NOT` clause on all nested paths when possible since `FILTER` clauses are more efficient. Here are some examples of queries and how they get rewritten: ``` "match_all": {} ``` This query gets rewritten to `ConstantScore(+*:* -_type:__*)` on master and `ConstantScore(_type:AutomatonQuery {\norg.apache.lucene.util.automaton.Automaton@4371da44})` with this change. The automaton is the complement of `_type:__*` so it matches the same documents, but is faster since it is now a positive clause. Simplistic performance testing on a 10M index where each root document has 5 nested documents on average gave a latency of 420ms on master and 90ms with this change applied. ``` "term": { "foo": { "value": "0" } } ``` This query is rewritten to `+foo:0 #(ConstantScore(+*:* -_type:__*))^0.0` on master and `foo:0` with this change: we do not need to filter nested docs out since the query cannot match nested docs. While doing performance testing in the same conditions as above, response times went from 250ms to 50ms. ``` "nested": { "path": "nested", "query": { "term": { "nested.foo": { "value": "0" } } } } ``` This query is rewritten to `+ToParentBlockJoinQuery (+nested.foo:0 #_type:__nested) #(ConstantScore(+*:* -_type:__*))^0.0` on master and `ToParentBlockJoinQuery (nested.foo:0)` with this change. The top-level filter (`-_type:__*`) could be removed since `nested` queries only match documents of the parent space, as well as the child filter (`#_type:__nested`) since the child query may only match nested docs since the `nested` object has both `include_in_parent` and `include_in_root` set to `false`. While doing performance testing in the same conditions as above, response times went from 850ms to 270ms.
2017-02-14 16:05:19 +01:00
return null;
}
@Override
public SearchContextId id() {
return this.id;
}
@Override
public String source() {
return engineSearcher.source();
}
@Override
public ShardSearchRequest request() {
return this.request;
}
@Override
public SearchType searchType() {
return this.searchType;
}
@Override
public SearchShardTarget shardTarget() {
return this.shardTarget;
}
@Override
public int numberOfShards() {
return request.numberOfShards();
}
@Override
public float queryBoost() {
return queryBoost;
}
@Override
public long getOriginNanoTime() {
return originNanoTime;
}
@Override
public ScrollContext scrollContext() {
return this.scrollContext;
}
@Override
public SearchContext scrollContext(ScrollContext scrollContext) {
this.scrollContext = scrollContext;
return this;
}
@Override
public SearchContextAggregations aggregations() {
return aggregations;
}
@Override
public SearchContext aggregations(SearchContextAggregations aggregations) {
this.aggregations = aggregations;
return this;
}
2015-07-22 17:16:15 +02:00
@Override
public void addSearchExt(SearchExtBuilder searchExtBuilder) {
//it's ok to use the writeable name here given that we enforce it to be the same as the name of the element that gets
//parsed by the corresponding parser. There is one single name and one single way to retrieve the parsed object from the context.
searchExtBuilders.put(searchExtBuilder.getWriteableName(), searchExtBuilder);
2015-07-22 17:16:15 +02:00
}
@Override
public SearchExtBuilder getSearchExt(String name) {
return searchExtBuilders.get(name);
}
2015-07-29 17:20:06 +02:00
@Override
public SearchHighlightContext highlight() {
return highlight;
}
@Override
public void highlight(SearchHighlightContext highlight) {
this.highlight = highlight;
}
@Override
public SuggestionSearchContext suggest() {
return suggest;
}
@Override
public void suggest(SuggestionSearchContext suggest) {
this.suggest = suggest;
}
@Override
public List<RescoreContext> rescore() {
if (rescore == null) {
return Collections.emptyList();
}
return rescore;
}
@Override
public void addRescore(RescoreContext rescore) {
if (this.rescore == null) {
this.rescore = new ArrayList<>();
}
this.rescore.add(rescore);
}
@Override
public boolean hasScriptFields() {
return scriptFields != null;
}
@Override
public ScriptFieldsContext scriptFields() {
if (scriptFields == null) {
scriptFields = new ScriptFieldsContext();
}
return this.scriptFields;
}
/**
* A shortcut function to see whether there is a fetchSourceContext and it says the source is requested.
*/
@Override
public boolean sourceRequested() {
return fetchSourceContext != null && fetchSourceContext.fetchSource();
}
@Override
public boolean hasFetchSourceContext() {
return fetchSourceContext != null;
}
@Override
public FetchSourceContext fetchSourceContext() {
return this.fetchSourceContext;
}
@Override
public SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext) {
this.fetchSourceContext = fetchSourceContext;
return this;
}
@Override
public FetchDocValuesContext docValuesContext() {
return docValuesContext;
}
@Override
public SearchContext docValuesContext(FetchDocValuesContext docValuesContext) {
this.docValuesContext = docValuesContext;
return this;
}
@Override
public FetchFieldsContext fetchFieldsContext() {
return fetchFieldsContext;
}
@Override
public SearchContext fetchFieldsContext(FetchFieldsContext fetchFieldsContext) {
this.fetchFieldsContext = fetchFieldsContext;
return this;
}
@Override
public ContextIndexSearcher searcher() {
return this.searcher;
}
@Override
public IndexShard indexShard() {
return this.indexShard;
}
@Override
public MapperService mapperService() {
return indexService.mapperService();
}
@Override
public SimilarityService similarityService() {
return indexService.similarityService();
}
@Override
public BigArrays bigArrays() {
return bigArrays;
}
@Override
Upgrade master to lucene 5.0 snapshot This has a lot of improvements in lucene, particularly around memory usage, merging, safety, compressed bitsets, etc. On the elasticsearch side, summary of the larger changes: API changes: postings API became a "pull" rather than "push", collector API became per-segment, etc. packaging changes: add lucene-backwards-codecs.jar as a dependency. improvements to boolean filtering: especially ensuring it will not be slow for SparseBitSet. use generic BitSet api in plumbing so that concrete bitset type is an implementation detail. use generic BitDocIdSetFilter api for dedicated bitset cache, so there is type safety. changes to support atomic commits implement Accountable.getChildResources (detailed memory usage API) for fielddata, etc change handling of IndexFormatTooOld/New, since they no longer extends CorruptIndexException Closes #8347. Squashed commit of the following: commit d90d53f5f21b876efc1e09cbd6d63c538a16cd89 Author: Simon Willnauer <simonw@apache.org> Date: Wed Nov 5 21:35:28 2014 +0100 Make default codec/postings/docvalues format constants commit cb66c22c71cd304a36e7371b199a8c279908ae37 Merge: d4e2f6d ad4ff43 Author: Robert Muir <rmuir@apache.org> Date: Wed Nov 5 11:41:13 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit d4e2f6dfe767a5128c9b9ae9e75036378de08f47 Merge: 4e5445c 4111d93 Author: Robert Muir <rmuir@apache.org> Date: Wed Nov 5 06:26:32 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 4e5445c775f580730eb01360244e9330c0dc3958 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 16:19:19 2014 -0500 FixedBitSet -> BitSet commit 9887ea73e8b857eeda7f851ef3722ef580c92acf Merge: 1bf8894 fc84666 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 15:26:25 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 1bf8894430de3e566d0dc5623b0cc28b0d674ebb Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 15:22:51 2014 -0500 remove nocommit commit a9c2a2259ff79c69bae7806b64e92d5f472c18c8 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:48:43 2014 -0500 turn jenkins red again commit 067baaaa4d52fce772c81654dcdb5051ea79139f Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:18:21 2014 -0500 unzip from stream commit 82b6fba33d362aca2313cc0ca495f28f5ebb9260 Merge: b2214bb 6523cd9 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:10:59 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit b2214bb093ec2f759003c488c3c403c8931db914 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 13:09:53 2014 -0500 go back to my URL until we can figure out what is up with jenkins commit e7d614172240175a51f580aeaefb6460d21cede9 Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 10:52:54 2014 -0500 try this jenkins commit 337a3c7704efa7c9809bf373152d711ee55f876c Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 16:17:49 2014 +0100 Rename temp-files under lock to prevent metadata reads while renaming commit 77d5ba80d0a76efa549dd753b9f114b2f2d2d29c Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 10:07:11 2014 -0500 continue to treat too-old/too-new as corruption for now commit 98d0fd2f4851bc50e505a94ca592a694d502c51c Author: Robert Muir <rmuir@apache.org> Date: Tue Nov 4 09:24:21 2014 -0500 fix last nocommit commit 643fceed66c8caf22b97fc489d67b4a2a90a1a1c Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 14:46:17 2014 +0100 remove NoSuchDirectoryException commit 2e43c4feba05cfaf451df70f946c0930cbcc4557 Merge: 93826e4 8163107 Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 14:38:00 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 93826e4d56a6a97c2074669014af77ff519bde63 Merge: 7f10129 44e24d3 Author: Simon Willnauer <simonw@apache.org> Date: Tue Nov 4 12:54:27 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade Conflicts: src/main/java/org/elasticsearch/index/store/DistributorDirectory.java src/main/java/org/elasticsearch/index/store/Store.java src/main/java/org/elasticsearch/indices/recovery/RecoveryStatus.java src/test/java/org/elasticsearch/index/store/DistributorDirectoryTest.java src/test/java/org/elasticsearch/index/store/StoreTest.java src/test/java/org/elasticsearch/indices/recovery/RecoveryStatusTests.java commit 7f10129364623620575c109df725cf54488b3abb Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:32:24 2014 +0100 Fix TopHitsAggregator to not ignore the top-level/leaf collector split. commit 042fadc8603b997bdfdc45ca44fec70dc86774a6 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:31:20 2014 +0100 Remove MatchDocIdSet in favor of DocValuesDocIdSet. commit 7d877581ff5db585a674c95ac391ac78a0282826 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 4 11:10:08 2014 +0100 Make the and filter use the cost API. Lucene 5 ensured that cost() can safely be used, and this will have the benefit that the order in which filters are specified is not important anymore (only for slow random-access filters in practice). commit 78f1718aa2cd82184db7c3a8393e6215f43eb4a8 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 23:55:17 2014 -0500 fix previous eclipse import braindamage commit 186c40e9258ce32f22a9a714ab442a310b6376e0 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 22:32:34 2014 -0500 allow child queries to exhaust iterators again commit b0b1271305e1b6d0c4c4da51a3c54df1aa5c0605 Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 14:50:44 2014 -0800 Fix nocommit for mapping output. index_options will not be printed if the field is not indexed. commit ba223eb85e399c9620a347a983e29bf703953e7a Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 14:07:26 2014 -0800 Remove no commit for chinese analyzer provider. We should have a separate issue to address not using this provider on new indexes. commit ca554b03c4471797682b2fb724f25205cf040c4a Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 13:41:59 2014 -0800 Fix stop tests commit de67c4653ec47dee9c671390536110749d2bb05f Author: Ryan Ernst <ryan@iernst.net> Date: Mon Nov 3 12:51:17 2014 -0800 Remove analysis nocommits, switching over to Lucene43*Filters for backcompat commit 50cae9bec72c25c33a1ab8a8931bccb3355171e2 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 15:32:25 2014 -0500 add ram accounting and TODO lazy-loading (its no worse than master, can be a followup improvement) for suggesters commit 7a7f0122f138684b312d0f0b03dc2a9c16c15f9c Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 15:11:26 2014 -0500 bump lucene version commit cd0cae5c35e7a9e049f49ae45431f658fb86676b Merge: 446bc09 3c72073 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 14:49:05 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 446bc09b4e8bf4602d3c252b53ddaa0da65cce2f Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 14:46:30 2014 -0500 remove hack commit a19d85a968d82e6d00292b49630ef6ff2dbf2f32 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 12:53:11 2014 -0500 dont create exceptions with circular references on corruption (will open a PR for this) commit 0beefb9e821d97c37e90ec556d81ac7b00369b8a Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 11:47:14 2014 -0500 temporarily add craptastic detector for this horrible bug commit e9f2d298bff75f3d1591f8622441e459c3ce7ac3 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:56:01 2014 -0500 add nocommit commit e97f1d50a91a7129650b8effc7a9ecf74ca0569a Merge: c57a3c8 f1f50ac Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:12:12 2014 -0500 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit c57a3c8341ed61dca62eaf77fad6b8b48aeb6940 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 10:11:46 2014 -0500 fix nocommit commit dd0e77e4ec07c7011ab5f6b60b2ead33dc2333d2 Author: Robert Muir <rmuir@apache.org> Date: Mon Nov 3 09:54:09 2014 -0500 nocommit -> TODO, this is in much more places in the codebase, bigger issue commit 3cc3bf56d72d642059f8fe220d6f2fed608363e9 Author: Ryan Ernst <ryan@iernst.net> Date: Sat Nov 1 23:59:17 2014 -0700 Remove nocommit and awaitsfix for edge ngram filter test. commit 89f115245155511c0fbc0d5ee62e63141c3700c1 Author: Ryan Ernst <ryan@iernst.net> Date: Sat Nov 1 23:57:44 2014 -0700 Fix EdgeNGramTokenFilter logic for version <= 4.3, and fixed instanceof checks in corresponding tests to correctly check for reverse filter when applicable. commit 112df869cd199e36aab0e1a7a288bb1fdb2ebf1c Author: Robert Muir <rmuir@apache.org> Date: Sun Nov 2 00:08:30 2014 -0400 execute geo disjoint query/filter as intersects commit e5061273cc685f1252e9a3a9ae4877ec9bce7752 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:58:59 2014 -0400 remove chinese analyzer from docs commit ea1af11b8978fcc551f198e24fe21d52806993ef Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:29:00 2014 -0400 fix ram accounting bug commit 53c0a42c6aa81aa6bf81d3aa77b95efd513e0f81 Merge: e3bcd3c 6011a18 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:16:29 2014 -0400 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit e3bcd3cc07a4957e12c7b3affc462c31290a9186 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:15:01 2014 -0400 fix url-email back compat (thanks ryan) commit 91d6b096a96c357755abee167098607223be1aad Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 22:11:26 2014 -0400 bump lucene version commit d2bb9568df72b37ec7050d25940160b8517394bc Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 20:33:07 2014 -0400 remove nocommit commit 1d049c471e19e5c457262c7399c5bad9e023b2e3 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 20:28:58 2014 -0400 fix eclipse to group org/com imports together: without this, its madness commit 09d8c1585ee99b6e63be032732c04ef6fed84ed2 Author: Robert Muir <rmuir@apache.org> Date: Sat Nov 1 14:27:41 2014 -0400 remove nocommit, if you dont liek it, print assembly and tell me how it can be better commit 8a6a294313fdf33b50c7126ec20c07867ecd637c Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 20:01:55 2014 +0100 Remove deprecated usage of DocIdSets.newDocIDSet. commit 601bee60543610558403298124a84b1b3bbd1045 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 14:13:18 2014 -0400 maybe one of these zillions of annotations will stop thread leaks commit 9d3f69abc7267c5e455aefa26db95cb554b02d62 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 14:05:39 2014 -0400 fix some analysis nocommits commit 312e3a29c77214b8142d21c33a6b2c2b151acf9a Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 18:28:45 2014 +0100 Remove XConstantScoreQuery/XFilteredQuery/ApplyAcceptedDocsFilter. commit 5a0cb9f8e167215df7f1b1fad11eec6e6c74940f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 17:06:45 2014 +0100 Fix misleading documentation of DocIdSets.toCacheable. commit 8b4ef2b5b476fff4c79c0c2a0e4769ead26cf82b Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 17:05:59 2014 +0100 Fix CustomRandomAccessFilterStrategy to override the right method. commit d7a9a407a615987cfffc651f724fbd8795c9c671 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 16:21:35 2014 +0100 Better handle the special case when there is a single SHOULD clause. commit 648ad389f07e92dfc451f345549c9841ba5e4c9a Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 15:53:38 2014 +0100 Cut over XBooleanFilter to BitDocIdSet.Builder. The idea is similar to what happened to Lucene's BooleanFilter. Yet XBooleanFilter is a bit more sophisticated and I had to slightly change the way it is implemented in order to make it work. The main difference with before is that slow filters are now applied lazily, so eg. if you have 3 MUST clauses, two with a fast iterator and the third with a slow iterator, the previous implementation used to apply the fast iterators first and then only check the slow filter for bits which were set in the bit set. Now we are computing a bit set based on the fast must clauses and then basically returning a BitsFilteredDocIdSet.wrap(bitset, slowClause). Other than that, BooleanFilter still uses the bitset optimizations when or-ing and and-ind filters. Another improvement is that BooleanFilter is now aware of the cost API. commit b2dad312b4bc9f931dc3a25415dd81c0d9deee08 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 10:18:53 2014 -0400 clear nocommit commit 4851d2091e744294336dfade33906c75fbe695cd Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 15:15:16 2014 +0100 cut over to RoaringDocIdSet commit ca6aec24a901073e65ce4dd6b70964fd3612409e Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:57:30 2014 +0100 make nocommit more explicit commit d0742ee2cb7a6c48b0bbb31580b7fbcebdb6ec40 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:55:24 2014 -0400 fix standardtokenizer nocommit commit 7d6faccafff22a86af62af0384838391d46695ca Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:54:08 2014 +0100 fix compilation commit a038a405c1ff6458ad294e6b5bc469e622f699d0 Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:53:43 2014 +0100 fix compilation commit 30c9e307b1f5d80e2deca3392c0298682241207f Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:52:35 2014 +0100 fix compilation commit e5139bc5a0a9abd2bdc6ba0dfbcb7e3c2e7b8481 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:52:16 2014 -0400 clear nocommit here commit 85dd2cedf7a7994bed871ac421cfda06aaf5c0a5 Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:46:17 2014 +0100 fix CompletionPostingsFormatTest commit c0f3781f616c9b0ee3b5c4d0998810f595868649 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 09:38:00 2014 -0400 add tests for these analyzers commit 51f9999b4ad079c283ae762c862fd0e22d00445f Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 14:10:26 2014 +0100 remove nocommit - this is not an issue commit fd1388fa03e622b0738601c8aeb2dbf7949a6dd2 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 14:07:01 2014 +0100 Remove redundant null check commit 3d6dd51b0927337ba941a235446b22e8cd500dc3 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 14:01:37 2014 +0100 Removed the work around to prevent p/c error when invoking #iterator() twice, because the custom query filter wrapper now doesn't transform the result to a cache doc id set any more. I think the transforming to a cachable doc id set in CustomQueryWrappingFilter isn't needed at all, because we use the DocIdSet only once and because of that is just slowed things down. commit 821832a537e00cd1216064b379df3e01d2911d3a Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:54:33 2014 +0100 one more nocommit commit 77eb9ea4c4ea50afb2680c29682ddcb3851a9d4f Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Fri Oct 31 13:52:29 2014 +0100 Remove cast commit a400573c034ed602221f801b20a58a9186a06eae Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:49:24 2014 +0100 fix stop filter commit 51746087cf8ec34c4d20aa05ba8dbff7b3b43eec Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:21:36 2014 +0100 fix changed semantics of FBS.nextSetBit to check for NO_MORE_DOCS commit 8d0a4e2511310f1293860823fe3ba80ac771bbe3 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 08:13:44 2014 -0400 do the bogus cast differently commit 46a5cc5732dea096c0c80ae5ce42911c9c51e44e Author: Simon Willnauer <simonw@apache.org> Date: Fri Oct 31 13:00:16 2014 +0100 I hate it but P/C now passes commit 580c0c2f82bbeacf217e594f22312b11d1bdb839 Merge: a9d3c00 1645434 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 31 06:54:31 2014 -0400 fix nocommit/classcast commit a9d3c004d62fe04989f49a897e6ff84973c06eb9 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 31 08:49:31 2014 +0100 Update TODO. commit aa75af0b407792aeef32017f03a6f442ed970baa Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 19:18:25 2014 -0400 clear obselete nocommits from lucene bump commit d438534cf41fcbe2d88070e2f27c994625e082c2 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 18:53:20 2014 -0400 throw classcastexception when ES abuses regular filtercache for nested docs commit 2c751f3a8feda43ec127c34769b069de21f3d16f Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 18:31:34 2014 -0400 bump lucene revision, fix tests commit d6ef7f6304ae262bf6228a7d661b2a452df332be Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 22:37:58 2014 +0100 fix merge problems commit de9d361f88a9ce6bb3fba85285de41f223c95767 Merge: 41f6aab f6b37a3 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 22:28:59 2014 +0100 Merge branch 'master' into enhancement/lucene_5_0_upgrade Conflicts: pom.xml src/main/java/org/elasticsearch/Version.java src/main/java/org/elasticsearch/gateway/local/state/meta/MetaDataStateFormat.java commit 41f6aab388aa80c40b08a2facab2617576203a0d Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:48:46 2014 +0100 fix potiential NPE commit c4428b12e1ae838b91e847df8b4a8be7f49e10f4 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:38:46 2014 +0100 don't advance iterator in a match(doc) method commit 28ab948e99e3ea4497c9b1e468384806ba7e1790 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 17:34:58 2014 +0100 don't advance iterator in a match(doc) method commit eb0f33f6634fadfcf4b2bf7327400e568f0427bb Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 16:55:54 2014 +0100 fix GeoUtilsTest commit 7f711fe3eaf73b6c2268cf42d5a41132a61ad831 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 16:43:16 2014 +0100 Use a dedicated default index option if field type is not indexed by default commit 78e3f37ab779e3e1b25b45a742cc86ab5f975149 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 10:56:14 2014 -0400 disable this test with AwaitsFix to reduce noise commit 9a590f563c8e03a99ecf0505c92d12d7ab20d11d Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 09:38:49 2014 +0100 fix lucene version commit abe3ca1d8bb6b5101b545198f59aec44bacfa741 Author: Simon Willnauer <simonw@apache.org> Date: Thu Oct 30 09:35:05 2014 +0100 fix AnalyzingCompletionLookupProvider to wrok with new codec API commit 464293b245852d60bde050c6d3feb5907dcfbf5f Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:26:00 2014 -0400 don't try to write stuff to tests class directory commit 031cc6c19f4fe4423a034b515f77e5a0e282a124 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:12:36 2014 -0400 AwaitsFix these known issues to reduce noise commit 4600d51891e35847f2d344247d6f915a0605c0d1 Author: Robert Muir <rmuir@apache.org> Date: Thu Oct 30 00:06:53 2014 -0400 openbitset lives on commit 8492bae056249e2555d24acd55f1046b66a667c4 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:42:54 2014 -0400 fixes for filter tests commit 31f24ce4efeda31f97eafdb122346c7047a53bf2 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:12:38 2014 -0400 don't use fieldcache commit 8480789942fdff14a6d2b2cd8134502fe62f20c8 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 23:04:29 2014 -0400 ancient index no longer supported commit 02e78dc7ebdd827533009f542582e8db44309c57 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 23:37:02 2014 +0100 fix more tests commit ff746c6df23c50b3f3ec24922413b962c8983080 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 23:08:19 2014 +0100 fix all mapper commit e4fb84b517107b25cb064c66f83c9aa814a311b2 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:55:54 2014 +0100 fix distributor tests and cut over to FileStore API commit 20c850e2cfe3210cd1fb9e232afed8d4ac045857 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:42:18 2014 +0100 use DOCS_ONLY if index=true and current options == null commit 44169c108418413cfe51f5ce23ab82047463e4c2 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 22:33:36 2014 +0100 Fix index=yes|no settings in mappers commit a3c5f77987461a18121156ed345d42ded301c566 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:51:41 2014 +0100 fix several field mappers conversion from setIndexed to indexOptions commit df84d736908e88a031d710f98e222be68ae96af1 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:33:35 2014 +0100 fix SourceFieldMapper to be not indexed commit b2bf01d12a8271a31fb2df601162d0e89924c8f5 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 21:23:08 2014 +0100 Cut over to .liv files in store and corruption tests commit 619004df436f9ef05d24bef1b6a7f084c6b0ad75 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 17:05:52 2014 +0100 fix more tests commit b7ed653a8b464de446e00456bce0a89e47627c38 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 16:19:08 2014 +0100 [STORE] Add dedicated method to write temporary files Recovery writes temporary files which might not end up in the right distributor directories today. This commit adds a dedicated API that allows specifying the target file name in order to create the tempoary file in the correct directory. commit 7d574659f6ae04adc2b857146ad0d8d56ca66f12 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 10:28:49 2014 -0400 add some leniency to temporary bogus method commit f97022ea7c2259f7a5cf97d924c59ed75ab65b32 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 10:24:17 2014 -0400 fix MultiCollector bug commit b760533128c2b4eb10ad76e9689ef714293dd819 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:56:08 2014 +0100 CheckIndex is now closeable we need to close it commit 9dae9fb6d63546a6c2427be2a2d5c8358f5b1934 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:45:11 2014 +0100 s/Lucene51/Lucene50 commit 7aea9b86856a8c1b06a08e7c312ede1168af1287 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:42:30 2014 +0100 fix BloomFilterPostingsFormat commit 16fea6fe842e88665d59cc091e8224e8dc6ce08c Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:41:16 2014 +0100 fix some codec format issues commit 3d77aa97dd2c4012b63befef3f2ba2525965e8a6 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:30:43 2014 +0100 fix CodecTests commit 6ef823b1fde25657438ace1aabd9d552d6ae215e Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:26:47 2014 +0100 make it compile commit 9991eee1fe99435118d4dd42b297ffc83fce5ec5 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 09:12:43 2014 -0400 add an ugly hack for TopHitsAggregator for now commit 03e768a01fcae6b1f4cb50bcceec7d42977ac3e6 Author: Simon Willnauer <simonw@apache.org> Date: Wed Oct 29 14:01:02 2014 +0100 cut over ES090PostingsFormat commit 463d281faadb794fdde3b469326bdaada25af048 Merge: 0f8740a 8eac79c Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 08:30:36 2014 -0400 Merge branch 'master' into enhancement/lucene_5_0_upgrade commit 0f8740a782455a63524a5a82169f6bbbfc613518 Author: Robert Muir <rmuir@apache.org> Date: Wed Oct 29 01:00:15 2014 -0400 fix/hack remaining filter and analysis issues commit df534488569da13b31d66e581456dfd4b55156b9 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 23:11:47 2014 -0400 fix ngrams / openbitset usage commit 11f5dc3b9887f4da80a0fa1818e1350b30599329 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 22:42:44 2014 -0400 hack over sort comparators commit 4ebdc754350f512596f6a02770d223e9f5f7975a Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 21:27:07 2014 -0400 compiler errors < 100 commit 2d60c9e29de48ccb0347dd87f7201f47b67b83a0 Author: Robert Muir <rmuir@apache.org> Date: Tue Oct 28 03:13:08 2014 -0400 clear some nocommits around ram usage commit aaf47fe6c0aabcfb2581dd456fc50edf871da758 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 12:27:34 2014 -0400 migrate fieldinfo handling commit ef6ed6d15d8def71cd880d97249678136cd29fe3 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 12:07:13 2014 -0400 more simple fixes commit f475e1048ae697dd9da5bd9da445102b0b7bc5b3 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 11:58:21 2014 -0400 more fielddata ram accounting fixes commit 16b4239eaa9b4262df258257df4f31d39f28a3a2 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:47:32 2014 +0100 add missing file commit 5b542fa2a6da81e36a0c35b8e891a1d8bc58f663 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:43:29 2014 +0100 cut over completion posting formats - still some nocommits commit ecdea49404c4ec4e1b78fb54575825f21b4e096e Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 11:21:09 2014 -0400 fielddata accountable fixes commit d43da265718917e20c8264abd43342069198fe9c Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 16:19:53 2014 +0100 cut over BloomFilterPostings to new API commit 29b192ba621c14820175775d01242162b88bd364 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 10:22:51 2014 -0400 fix more analyzers commit 74b4a0c5283e323a7d02490df469497c722780d2 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 09:54:25 2014 -0400 fix tests commit 554084ccb4779dd6b1c65fa7212ad1f64f3a6968 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:51:48 2014 +0100 maintain supressed exceptions on CorruptIndexException commit cf882d9112c5e8ef1e9f2b0f800f7aa59001a4f2 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:47:17 2014 +0100 commitOnClose=false commit ebb2a9189ab2f459b7c6c9985be610fd90dfe410 Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:46:06 2014 +0100 cut over indexwriter closeing in InternalEngine commit cd21b3d4706f0b562bd37792d077d60832aff65f Author: Simon Willnauer <simonw@apache.org> Date: Mon Oct 27 14:38:10 2014 +0100 fix constant commit f93f900c4a1c90af3a21a4af5735a7536423fe28 Author: Robert Muir <rmuir@apache.org> Date: Mon Oct 27 09:50:49 2014 -0400 fix test commit a9a752940b1ab4699a6a08ba8b34afca82b843fe Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Mon Oct 27 09:26:18 2014 +0100 Be explicit about the index options commit d9ee815babd030fa2ceaec9f467c105ee755bf6b Author: Simon Willnauer <simonw@apache.org> Date: Sun Oct 26 20:03:44 2014 +0100 cut over store and directory commit b3f5c8e39039dd8f5caac0c4dd1fc3b1116e64ca Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 13:08:39 2014 -0400 more test fixes commit 8842f2684e3606aae0860c27f7a4c53e273d47fb Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 12:14:52 2014 -0400 tests manual labor commit c43de5aec337919a3fdc3638406dff17fc80bc98 Author: Robert Muir <rmuir@apache.org> Date: Sun Oct 26 11:04:13 2014 -0400 BytesRef -> BytesRefBuilder commit 020c0d087a2f37566a1db390b0e044ebab030138 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:53:37 2014 +0100 Moved over to BitSetFilter commit 48dd1b909e6c52cef733961c9ecebfe4f67109fe Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:53:11 2014 +0100 Left over Collector api change in ScanContext commit 6ec248ef63f262bcda400181b838fd9244752625 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 15:47:40 2014 +0100 Moved indexed() over to indexOptions != null or indexOptions == null commit 9937aebfd8546ae4bb652cd976b3b43ac5ab7a63 Author: Martijn van Groningen <martijn.v.groningen@gmail.com> Date: Sun Oct 26 13:26:31 2014 +0100 Fixed many compile errors. Mainly around the breaking Collector api change in 5.0. commit fec32c4abc0e3309cf34260c8816305a6f820c9e Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 11:22:17 2014 -0400 more easy fixes commit dab22531d801800d17a65dc7c9464148ce8ebffd Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 09:33:41 2014 -0400 more progress commit 414767e9a955010076b0497cc4f6d0c1850b48d3 Author: Robert Muir <rmuir@apache.org> Date: Sat Oct 25 06:33:17 2014 -0400 more progress commit ad9d969fddf139a8830254d3eb36a908ba87cc12 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 24 14:28:01 2014 -0400 current state of fun commit 464475eecb0be15d7d084135ed16051f76a7e521 Author: Robert Muir <rmuir@apache.org> Date: Fri Oct 24 11:42:41 2014 -0400 bump to 5.0 snapshot
2014-11-05 15:48:51 -05:00
public BitsetFilterCache bitsetFilterCache() {
return indexService.cache().bitsetFilterCache();
}
@Override
public <IFD extends IndexFieldData<?>> IFD getForField(MappedFieldType fieldType) {
return queryShardContext.getForField(fieldType);
}
@Override
public TimeValue timeout() {
return timeout;
}
@Override
public void timeout(TimeValue timeout) {
this.timeout = timeout;
}
@Override
public int terminateAfter() {
return terminateAfter;
}
@Override
public void terminateAfter(int terminateAfter) {
this.terminateAfter = terminateAfter;
}
@Override
public SearchContext minimumScore(float minimumScore) {
this.minimumScore = minimumScore;
return this;
}
@Override
public Float minimumScore() {
return this.minimumScore;
}
@Override
public SearchContext sort(SortAndFormats sort) {
this.sort = sort;
return this;
}
@Override
public SortAndFormats sort() {
return this.sort;
}
@Override
public SearchContext trackScores(boolean trackScores) {
this.trackScores = trackScores;
return this;
}
@Override
public boolean trackScores() {
return this.trackScores;
}
@Override
public SearchContext trackTotalHitsUpTo(int trackTotalHitsUpTo) {
this.trackTotalHitsUpTo = trackTotalHitsUpTo;
return this;
}
@Override
public int trackTotalHitsUpTo() {
return trackTotalHitsUpTo;
}
@Override
public SearchContext searchAfter(FieldDoc searchAfter) {
this.searchAfter = searchAfter;
return this;
}
@Override
public boolean lowLevelCancellation() {
return lowLevelCancellation;
}
@Override
public FieldDoc searchAfter() {
return searchAfter;
}
@Override
public SearchContext collapse(CollapseContext collapse) {
this.collapse = collapse;
return this;
}
@Override
public CollapseContext collapse() {
return collapse;
}
public SearchContext sliceBuilder(SliceBuilder sliceBuilder) {
this.sliceBuilder = sliceBuilder;
return this;
}
@Override
public SearchContext parsedPostFilter(ParsedQuery postFilter) {
this.postFilter = postFilter;
return this;
}
@Override
public ParsedQuery parsedPostFilter() {
return this.postFilter;
}
@Override
public Query aliasFilter() {
return aliasFilter;
}
@Override
public SearchContext parsedQuery(ParsedQuery query) {
this.originalQuery = query;
this.query = query.query();
return this;
}
@Override
public ParsedQuery parsedQuery() {
return this.originalQuery;
}
/**
* The query to execute, in its rewritten form.
*/
@Override
public Query query() {
return this.query;
}
@Override
public int from() {
return from;
}
@Override
public SearchContext from(int from) {
this.from = from;
return this;
}
@Override
public int size() {
return size;
}
@Override
public SearchContext size(int size) {
this.size = size;
return this;
}
@Override
public boolean hasStoredFields() {
return storedFields != null && storedFields.fieldNames() != null;
}
@Override
public boolean hasStoredFieldsContext() {
return storedFields != null;
}
@Override
public StoredFieldsContext storedFieldsContext() {
return storedFields;
}
@Override
public SearchContext storedFieldsContext(StoredFieldsContext storedFieldsContext) {
this.storedFields = storedFieldsContext;
return this;
}
@Override
public boolean storedFieldsRequested() {
return storedFields == null || storedFields.fetchFields();
}
@Override
public boolean explain() {
return explain;
}
@Override
public void explain(boolean explain) {
this.explain = explain;
}
@Override
@Nullable
public List<String> groupStats() {
return this.groupStats;
}
@Override
public void groupStats(List<String> groupStats) {
this.groupStats = groupStats;
}
@Override
public boolean version() {
return version;
}
@Override
public void version(boolean version) {
this.version = version;
}
@Override
public boolean seqNoAndPrimaryTerm() {
return seqAndPrimaryTerm;
}
@Override
public void seqNoAndPrimaryTerm(boolean seqNoAndPrimaryTerm) {
this.seqAndPrimaryTerm = seqNoAndPrimaryTerm;
}
@Override
public int[] docIdsToLoad() {
return docIdsToLoad;
}
@Override
public int docIdsToLoadFrom() {
return docsIdsToLoadFrom;
}
@Override
public int docIdsToLoadSize() {
return docsIdsToLoadSize;
}
@Override
public SearchContext docIdsToLoad(int[] docIdsToLoad, int docsIdsToLoadFrom, int docsIdsToLoadSize) {
this.docIdsToLoad = docIdsToLoad;
this.docsIdsToLoadFrom = docsIdsToLoadFrom;
this.docsIdsToLoadSize = docsIdsToLoadSize;
return this;
}
@Override
public void accessed(long accessTime) {
this.lastAccessTime = accessTime;
}
@Override
public long lastAccessTime() {
return this.lastAccessTime;
}
@Override
public long keepAlive() {
return this.keepAlive;
}
@Override
public void keepAlive(long keepAlive) {
this.keepAlive = keepAlive;
}
@Override
public DfsSearchResult dfsResult() {
return dfsResult;
}
@Override
public QuerySearchResult queryResult() {
return queryResult;
}
@Override
public FetchPhase fetchPhase() {
return fetchPhase;
}
@Override
public FetchSearchResult fetchResult() {
return fetchResult;
}
@Override
public MappedFieldType fieldType(String name) {
return mapperService().fieldType(name);
}
@Override
public ObjectMapper getObjectMapper(String name) {
return mapperService().getObjectMapper(name);
}
@Override
public long getRelativeTimeInMillis() {
return relativeTimeSupplier.getAsLong();
}
@Override
public Map<Class<?>, Collector> queryCollectors() {
return queryCollectors;
}
@Override
public QueryShardContext getQueryShardContext() {
return queryShardContext;
}
@Override
Add ability to profile query and collectors Provides a new flag which can be enabled on a per-request basis. When `"profile": true` is set, the search request will execute in a mode that collects detailed timing information for query components. ``` GET /test/test/_search { "profile": true, "query": { "match": { "foo": "bar" } } } ``` Closes #14889 Squashed commit of the following: commit a92db5723d2c61b8449bd163d2f006d12f9889ad Merge: 117dd99 3f87b08 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 17 09:44:10 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 117dd9992e8014b70203c6110925643769d80e62 Merge: 9b29d68 82a64fd Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Dec 15 13:27:18 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler Conflicts: core/src/main/java/org/elasticsearch/search/SearchService.java commit 9b29d6823a71140ecd872df25ff9f7478e7fe766 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 16:13:23 2015 -0500 [TEST] Profile flag needs to be set, ensure searches go against primary only for consistency commit 4d602d8ad1f8cbc7b475450921fa3bc7d395b34f Merge: 8b48e87 7742c1e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:25 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 8b48e876348b163ab730eeca7fa35142165b05f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:56:01 2015 -0500 Delegate straight to in.matchCost, no need for profiling commit fde3b0587911f0b5f15e779c671d0510cbd568a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:28:23 2015 -0500 Documentation tweaks, renaming build_weight -> create_weight commit 46f5e011ee23fe9bb8a1f11ceb4fa9d19fe48e2e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Dec 14 10:27:52 2015 -0500 Profile TwoPhaseIterator should override matchCost() commit b59f894ddb11b2a7beebba06c4ec5583ff91a7b2 Merge: 9aa1a3a b4e0c87 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 14:23:26 2015 -0500 Merge remote-tracking branch 'upstream/master' into query_profiler commit 9aa1a3a25c34c9cd9fffaa6114c25a0ec791307d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:48 2015 -0500 Revert "Move some of the collector wrapping logic into ProfileCollectorBuilder" This reverts commit 02cc31767fb76a7ecd44a302435e93a05fb4220e. commit 57f7c04cea66b3f98ba2bec4879b98e4fba0b3c0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:41:31 2015 -0500 Revert "Rearrange if/else to make intent clearer" This reverts commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00. commit 2874791b9c9cd807113e75e38be465f3785c154e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 9 13:38:13 2015 -0500 Revert "Move state into ProfileCollectorBuilder" This reverts commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6. commit 0bb3ee0dd96170b06f07ec9e2435423d686a5ae6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Dec 3 11:21:55 2015 -0500 Move state into ProfileCollectorBuilder commit 59b63c533fcaddcdfe4656e86a6f6c4cb1bc4a00 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:21:12 2015 -0500 Rearrange if/else to make intent clearer commit 511db0af2f3a86328028b88a6b25fa3dfbab963b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:12:06 2015 -0500 Rename WEIGHT -> BUILD_WEIGHT commit 02cc31767fb76a7ecd44a302435e93a05fb4220e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Dec 2 17:11:22 2015 -0500 Move some of the collector wrapping logic into ProfileCollectorBuilder commit e69356d3cb4c60fa281dad36d84faa64f5c32bc4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:12:35 2015 -0500 Cleanup imports commit c1b4f284f16712be60cd881f7e4a3e8175667d62 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:11:25 2015 -0500 Review cleanup: Make InternalProfileShardResults writeable commit 9e61c72f7e1787540f511777050a572b7d297636 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 15:01:22 2015 -0500 Review cleanup: Merge ProfileShardResult, InternalProfileShardResult. Convert to writeable commit 709184e1554f567c645690250131afe8568a5799 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:38:08 2015 -0500 Review cleanup: Merge ProfileResult, InternalProfileResult. Convert to writeable commit 7d72690c44f626c34e9c608754bc7843dd7fd8fe Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 14:01:34 2015 -0500 Review cleanup: use primitive (and default) for profile flag commit 97d557388541bbd3388cdcce7d9718914d88de6d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:09:12 2015 -0500 Review cleanup: Use Collections.emptyMap() instead of building an empty one explicitly commit 219585b8729a8b0982e653d99eb959efd0bef84e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:08:12 2015 -0500 Add todo to revisit profiler architecture in the future commit b712edb2160e032ee4b2f2630fadf131a0936886 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 30 13:05:32 2015 -0500 Split collector serialization from timing, use writeable instead of streamable Previously, the collector timing was done in the same class that was serialized, which required leaving the collector null when serializing. Besides being a bit gross, this made it difficult to change the class to Writeable. This splits up the timing (InternalProfileCollector + ProfileCollector) and the serialization of the times (CollectorResult). CollectorResult is writeable, and also acts as the public interface. commit 6ddd77d066262d4400e3d338b11cebe7dd27ca78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 13:15:12 2015 -0500 Remove dead code commit 06033f8a056e2121d157654a65895c82bbe93a51 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 12:49:51 2015 -0500 Review cleanup: Delegate to in.getProfilers() Note: Need to investigate how this is used exactly so we can add a test, it isn't touched by a normal inner_hits query... commit a77e13da21b4bad1176ca2b5d5b76034fb12802f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:59:58 2015 -0500 Review cleanup: collapse to single `if` statement commit e97bb6215a5ebb508b0293ac3acd60d5ae479be1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 11:39:43 2015 -0500 Review cleanup: Return empty map instead of null for profile results Note: we still need to check for nullness in SearchPhaseController, since an empty/no-hits result won't have profiling instantiated (or any other component like aggs or suggest). Therefore QuerySearchResult.profileResults() is still @Nullable commit db8e691de2a727389378b459fa76c942572e6015 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Nov 25 10:14:47 2015 -0500 Review cleanup: renaming, formatting fixes, assertions commit 9011775fe80ba22c2fd948ca64df634b4e32772d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:09:52 2015 -0500 [DOCS] Add missing annotation commit 4b58560b06f08d4b99b149af20916ee839baabd7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Nov 19 20:07:17 2015 -0500 [DOCS] Update documentation for new format commit f0458c58e5538ed8ec94849d4baf3250aa9ec841 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:14:09 2015 +0100 Reduce visibility of internal classes. commit d0a7d319098e60b028fa772bf8a99b2df9cf6146 Merge: e158070 1bdf29e Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:09:18 2015 +0100 Merge branch 'master' into query_profiler commit e158070a48cb096551f3bb3ecdcf2b53bbc5e3c5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Nov 17 10:08:48 2015 +0100 Fix compile error due to bad html in javadocs. commit a566b5d08d659daccb087a9afbe908ec3d96cd6e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:37 2015 -0500 Remove unused collector commit 4060cd72d150cc68573dbde62ca7321c47f75703 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:48:10 2015 -0500 Comment cleanup commit 43137952bf74728f5f5d5a8d1bfc073e0f9fe4f9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Nov 16 17:32:06 2015 -0500 Fix negative formatted time commit 5ef3a980266326aff12d4fe380f73455ff28209f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 17:10:17 2015 +0100 Fix javadocs. commit 276114d29e4b17a0cc0982cfff51434f712dc59e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 16:25:23 2015 +0100 Fix: include rewrite time as well... commit 21d9e17d05487bf4903ae3d2ab6f429bece2ffef Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 15:10:15 2015 +0100 Remove TODO about profiling explain. commit 105a31e8e570efb879447159c3852871f5cf7db4 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:59:30 2015 +0100 Fix nocommit now that the global collector is a root collector. commit 2e8fc5cf84adb1bfaba296808c329e5f982c9635 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 14:53:38 2015 +0100 Make collector wrapping more explicit/robust (and a bit less magical). commit 5e30b570b0835e1ce79a57933a31b6a2d0d58e2d Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 12:44:03 2015 +0100 Simplify recording API a bit. commit 9b453afced6adc0a59ca1d67d90c28796b105185 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:54:25 2015 +0100 Fix serialization-related nocommits. commit ad97b200bb123d4e9255e7c8e02f7e43804057a5 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Nov 13 10:46:30 2015 +0100 Fix DFS. commit a6de06986cd348a831bd45e4f524d2e14d9e03c3 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:29:16 2015 +0100 Remove forbidden @Test annotation. commit 4991a28e19501109af98026e14756cb25a56f4f4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 19:25:59 2015 +0100 Limit the impact of query profiling on the SearchContext API. Rule is: we can put as much as we want in the search.profile package but should aim at touching as little as possible other areas of the code base. commit 353d8d75a5ce04d9c3908a0a63d4ca6e884c519a Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 18:05:09 2015 +0100 Remove dead code. commit a3ffafb5ddbb5a2acf43403c946e5ed128f47528 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:35 2015 +0100 Remove call to forbidden String.toLowerCase() API. commit 1fa8c7a00324fa4e32bd24135ebba5ecf07606f1 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:30:27 2015 +0100 Fix compilation. commit 2067f1797e53bef0e1a8c9268956bc5fb8f8ad97 Merge: 22e631f fac472f Author: Adrien Grand <jpountz@gmail.com> Date: Thu Nov 12 15:21:12 2015 +0100 Merge branch 'master' into query_profiler commit 22e631fe6471fed19236578e97c628d5cda401a9 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:52:05 2015 -0500 Fix and simplify serialization of shard profile results commit 461da250809451cd2b47daf647343afbb4b327f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:32:22 2015 -0500 Remove helper methods, simpler without them commit 5687aa1c93d45416d895c2eecc0e6a6b302139f2 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Nov 3 18:29:32 2015 -0500 [TESTS] Fix tests for new rewrite format commit ba9e82857fc6d4c7b72ef4d962d2102459365299 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 30 15:28:14 2015 -0400 Rewrites begone! Record all rewrites as a single time metric commit 5f28d7cdff9ee736651d564f71f713bf45fb1d91 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:36:06 2015 -0400 Merge duplicate rewrites into one entry By using the Query as the key in a map, we can easily merge rewrites together. This means the preProcess(), assertion and main query rewrites all get merged together. Downside is that rewrites of the same Query (hashcode) but in different places get lumped together. I think the simplicity of the solution is better than the slight loss in output fidelity. commit 9a601ea46bb21052746157a45dcc6de6bc350e9c Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 15:28:27 2015 -0400 Allow multiple "searches" per profile (e.g. query + global agg) commit ee30217328381cd83f9e653d3a4d870c1d2bdfce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:29:18 2015 -0400 Update comment, add nullable annotation commit 405c6463a64e118f170959827931e8c6a1661f13 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 29 11:04:30 2015 -0400 remove out-dated comment commit 2819ae8f4cf1bfd5670dbd1c0e06195ae457b58f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:47 2015 +0100 Don't render children in the profiles when there are no children. commit 7677c2ddefef321bbe74660471603d202a4ab66f Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:35 2015 +0100 Set the profiler on the ContextIndexSearcher. commit 74a4338c35dfed779adc025ec17cfd4d1c9f66f5 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:50:01 2015 +0100 Fix json rendering. commit 6674d5bebe187b0b0d8b424797606fdf2617dd27 Author: Adrien Grand <jpountz@gmail.com> Date: Tue Oct 27 19:20:19 2015 +0100 Revert "nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called" This reverts commit d3dc10949024342055f0d4fb7e16c7a43423bfab. commit d3dc10949024342055f0d4fb7e16c7a43423bfab Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 17:20:57 2015 -0400 nocommit - profiling never enabled because setProfile() on ContextIndexSearcher never called Previously, it was enabled by using DefaultSearchContext as a third-party "proxy", but since the refactor to make it unit testable, setProfile() needs to be called explicitly. Unfortunately, this is not possible because SearchService only has access to an IndexSearcher. And it is not cast'able to a DefaultIndexSearcher. commit b9ba9c5d1f93b9c45e97b0a4e35da6f472c9ea53 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:27:00 2015 -0400 [TESTS] Fix unit tests commit cf5d1e016b2b4a583175e07c16c7152f167695ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:22:34 2015 -0400 Increment token after recording a rewrite commit b7d08f64034e498533c4a81bff8727dd8ac2843e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:14:09 2015 -0400 Fix NPE if a top-level root doesn't have children commit e4d3b514bafe2a3a9db08438c89f0ed68628f2d6 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:47 2015 -0400 Fix NPE when profiling is disabled commit 445384fe48ed62fdd01f7fc9bf3e8361796d9593 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 16:05:37 2015 -0400 [TESTS] Fix integration tests commit b478296bb04fece827a169e7522df0a5ea7840a3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 15:43:24 2015 -0400 Move rewrites to their own section, remove reconciliation Big commit because the structural change affected a lot of the wrapping code. Major changes: - Rewrites are now in their own section in the response - Reconciliation is gone...we don't attempt to roll the rewrites into the query tree structure - InternalProfileShardResults (plural) simply holds a Map<String, InternalProfileShardResult> and helps to serialize / ToXContent - InternalProfileShardResult (singular) is now the holder for all shard-level profiling details. Currently this includes query, collectors and rewrite. In the future it would hold suggest, aggs, etc - When the user requests the profiled results, they get back a Map<String, ProfileShardResult> instead of doing silly helper methods to convert to maps, etc - Shard details are baked into a string instead of serializing the object commit 24819ad094b208d0e94f17ce9c3f7c92f7414124 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Oct 23 10:25:38 2015 -0400 Make Profile results immutable by removing relative_time commit bfaf095f45fed74194ef78160a8e5dcae1850f9e Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:54:59 2015 +0200 Add nocommits. commit e9a128d0d26d5b383b52135ca886f2c987850179 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:39:37 2015 +0200 Move all profile-related classes to the same package. commit f20b7c7fdf85384ecc37701bb65310fb8c20844f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Oct 23 10:33:14 2015 +0200 Reorganize code a bit to ease unit testing of ProfileCollector. commit 3261306edad6a0c70f59eaee8fe58560f61a75fd Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:07:28 2015 +0200 Remove irrelevant nocommit. commit a6ac868dad12a2e17929878681f66dbd0948d322 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 18:06:45 2015 +0200 Make CollectorResult's reason a free-text field to ease bw compat. commit 5d0bf170781a950d08b81871cd1e403e49f3cc12 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 16:50:52 2015 +0200 Add unit tests for ProfileWeight/ProfileScorer. commit 2cd88c412c6e62252504ef69a59216adbb574ce4 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:55:17 2015 +0200 Rename InternalQueryProfiler to Profiler. commit 84f5718fa6779f710da129d9e0e6ff914fd85e36 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 15:53:58 2015 +0200 Merge InternalProfileBreakdown into ProfileBreakdown. commit 135168eaeb8999c8117ea25288104b0961ce9b35 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 13:56:57 2015 +0200 Make it possible to instantiate a ContextIndexSearcher without SearchContext. commit 5493fb52376b48460c4ce2dedbe00cc5f6620499 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:53:29 2015 +0200 Move ProfileWeight/Scorer to their own files. commit bf2d917b9dae3b32dfc29c35a7cac4ccb7556cce Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:38:24 2015 +0200 Fix bug that caused phrase queries to fail. commit b2bb0c92c343334ec1703a221af24a1b55e36d53 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:36:17 2015 +0200 Parsing happens on the coordinating node now. commit 416cabb8621acb5cd8dfa77374fd23e428f52fe9 Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 11:22:17 2015 +0200 Fix compilation (in particular remove guava deps). commit f996508645f842629d403fc2e71c1890c0e2cac9 Merge: 4616a25 bc3b91e Author: Adrien Grand <jpountz@gmail.com> Date: Thu Oct 22 10:44:38 2015 +0200 Merge branch 'master' into query_profiler commit 4616a25afffe9c24c6531028f7fccca4303d2893 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:32 2015 -0400 Make Java Count API compatible with profiling commit cbfba74e16083d719722500ac226efdb5cb2ff55 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 12:11:19 2015 -0400 Fix serialization of profile query param, NPE commit e33ffac383b03247046913da78c8a27e457fae78 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Oct 20 11:17:48 2015 -0400 TestSearchContext should return null Profiler instead of exception commit 73a02d69b466dc1a5b8a5f022464d6c99e6c2ac3 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:07:29 2015 -0400 [DOCS] Update docs to reflect new ID format commit 36248e388c354f954349ecd498db7b66f84ce813 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Oct 19 12:03:03 2015 -0400 Use the full [node][index][shard] string as profile result ID commit 5cfcc4a6a6b0bcd6ebaa7c8a2d0acc32529a80e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:51:40 2015 -0400 Add failing test for phrase matching Stack trace generated: [2015-10-15 17:50:54,438][ERROR][org.elasticsearch.search.profile] shard [[JNj7RX_oSJikcnX72aGBoA][test][2]], reason [RemoteTransportException[[node_s0][local[1]][indices:data/read/search[phase/query]]]; nested: QueryPhaseExecutionException[Query Failed [Failed to execute main query]]; nested: AssertionError[nextPosition() called more than freq() times!]; ], cause [java.lang.AssertionError: nextPosition() called more than freq() times! at org.apache.lucene.index.AssertingLeafReader$AssertingPostingsEnum.nextPosition(AssertingLeafReader.java:353) at org.apache.lucene.search.ExactPhraseScorer.phraseFreq(ExactPhraseScorer.java:132) at org.apache.lucene.search.ExactPhraseScorer.access$000(ExactPhraseScorer.java:27) at org.apache.lucene.search.ExactPhraseScorer$1.matches(ExactPhraseScorer.java:69) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$2.matches(ProfileQuery.java:226) at org.apache.lucene.search.ConjunctionDISI$TwoPhaseConjunctionDISI.matches(ConjunctionDISI.java:175) at org.apache.lucene.search.ConjunctionDISI$TwoPhase.matches(ConjunctionDISI.java:213) at org.apache.lucene.search.ConjunctionDISI.doNext(ConjunctionDISI.java:128) at org.apache.lucene.search.ConjunctionDISI.nextDoc(ConjunctionDISI.java:151) at org.apache.lucene.search.ConjunctionScorer.nextDoc(ConjunctionScorer.java:62) at org.elasticsearch.common.lucene.search.ProfileQuery$ProfileScorer$1.nextDoc(ProfileQuery.java:205) at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:224) at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:169) at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:795) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:509) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:347) at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:111) at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:366) at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:378) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368) at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365) at org.elasticsearch.transport.local.LocalTransport$2.doRun(LocalTransport.java:280) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) commit 889fe6383370fe919aaa9f0af398e3040209e40b Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 17:30:38 2015 -0400 [DOCS] More docs commit 89177965d031d84937753538b88ea5ebae2956b0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Oct 15 09:59:09 2015 -0400 Fix multi-stage rewrites to recursively find most appropriate descendant rewrite Previously, we chose the first rewrite that matched. But in situations where a query may rewrite several times, this won't build the tree correctly. Instead we need to recurse down all the rewrites until we find the most appropriate "leaf" rewrite The implementation of this is kinda gross: we recursively call getRewrittenParentToken(), which does a linear scan over the rewriteMap and tries to find rewrites with a larger token value (since we know child tokens are always larger). Can almost certainly find a better way to do this... commit 0b4d782b5348e5d03fd26f7d91bc4a3fbcb7f6a5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Oct 14 19:30:06 2015 -0400 [Docs] Documentation checkpoint commit 383636453f6610fcfef9070c21ae7ca11346793e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 16:02:22 2015 -0400 Comments commit a81e8f31e681be16e89ceab9ba3c3e0a018f18ef Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Sep 16 15:48:49 2015 -0400 [TESTS] Ensure all tests use QUERY_THEN_FETCH, DFS does not profile commit 1255c2d790d85fcb9cbb78bf2a53195138c6bc24 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 16:43:46 2015 -0400 Refactor rewrite handling to handle identical rewrites commit 85b7ec82eb0b26a6fe87266b38f5f86f9ac0c44f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:51:14 2015 -0400 Don't update parent when a token is added as root -- Fixes NPE commit 109d02bdbc49741a3b61e8624521669b0968b839 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Sep 15 08:50:40 2015 -0400 Don't set the rewritten query if not profiling -- Fixes NPE commit 233cf5e85f6f2c39ed0a2a33d7edd3bbd40856e8 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:04:51 2015 -0400 Update tests to new response format commit a930b1fc19de3a329abc8ffddc6711c1246a4b15 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 18:03:58 2015 -0400 Fix serialization commit 69afdd303660510c597df9bada5531b19d134f3d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 15:11:31 2015 -0400 Comments and cleanup commit 64e7ca7f78187875378382ec5d5aa2462ff71df5 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 14:40:21 2015 -0400 Move timing into dedicated class, add proper rewrite integration commit b44ff85ddbba0a080e65f2e7cc8c50d30e95df8e Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Sep 14 12:00:38 2015 -0400 Checkpoint - Refactoring to use a token-based dependency tree commit 52cedd5266d6a87445c6a4cff3be8ff2087cd1b7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Fri Sep 4 19:18:19 2015 -0400 Need to set context profiling flag before calling queryPhase.preProcess commit c524670cb1ce29b4b3a531fa2bff0c403b756f46 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 18:00:37 2015 +0200 Reduce profiling overhead a bit. This removes hash-table lookups everytime we start/stop a profiling clock. commit 111444ff8418737082236492b37321fc96041e09 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:18:59 2015 +0200 Add profiling of two-phase iterators. This is useful for eg. phrase queries or script filters, since they are typically consumed through their two-phase iterator instead of the scorer. commit f275e690459e73211bc8494c6de595c0320f4c0b Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 16:03:21 2015 +0200 Some more improvements. I changed profiling to disable bulk scoring, since it makes it impossible to know where time is spent. Also I removed profiling of operations that are always fast (eg. normalization) and added nextDoc/advance. commit 3c8dcd872744de8fd76ce13b6f18f36f8de44068 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:39:50 2015 +0200 Remove println. commit d68304862fb38a3823aebed35a263bd9e2176c2f Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 14:36:03 2015 +0200 Fix some test failures introduced by the rebase... commit 04d53ca89fb34b7a21515d770c32aaffcc513b90 Author: Adrien Grand <jpountz@gmail.com> Date: Fri Sep 4 13:57:35 2015 +0200 Reconcile conflicting changes after rebase commit fed03ec8e2989a0678685cd6c50a566cec42ea4f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Thu Aug 20 22:40:39 2015 -0400 Add Collectors to profile results Profile response element has now been re-arranged so that everything is listed per-shard to facilitate grouping elements together. The new `collector` element looks like this: ``` "profile": { "shards": [ { "shard_id": "keP4YFywSXWALCl4m4k24Q", "query": [...], "collector": [ { "name": "MultiCollector", "purpose": "search_multi", "time": "16.44504400ms", "relative_time": "100.0000000%", "children": [ { "name": "FilteredCollector", "purpose": "search_post_filter", "time": "4.556013000ms", "relative_time": "27.70447437%", "children": [ { "name": "SimpleTopScoreDocCollector", "purpose": "search_sorted", "time": "1.352166000ms", "relative_time": "8.222331299%", "children": [] } ] }, { "name": "BucketCollector: [[non_global_term, another_agg]]", "purpose": "aggregation", "time": "10.40379400ms", "relative_time": "63.26400829%", "children": [] }, ... ``` commit 1368b495c934be642c00f6cbf9fc875d7e6c07ff Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Aug 19 12:43:03 2015 -0400 Move InternalProfiler to profile package commit 53584de910db6d4a6bb374c9ebb954f204882996 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 18:34:58 2015 -0400 Only reconcile rewrite timing when rewritten query is different from original commit 9804c3b29d2107cd97f1c7e34d77171b62cb33d0 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 16:40:15 2015 -0400 Comments and cleanup commit 8e898cc7c59c0c1cc5ed576dfed8e3034ca0967f Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:19:07 2015 -0400 [TESTS] Fix comparison test to ensure results sort identically commit f402a29001933eef29d5a62e81c8563f1c8d0969 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:59 2015 -0400 Add note about DFS being unable to profile commit d446e08d3bc91cd85b24fc908e2d82fc5739d598 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 14:17:23 2015 -0400 Implement some missing methods commit 13ca94fb86fb037a30d181b73d9296153a63d6e4 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:10:54 2015 -0400 [TESTS] Comments & cleanup commit c76c8c771fdeee807761c25938a642612a6ed8e7 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 13:06:08 2015 -0400 [TESTS] Fix profileMatchesRegular to handle NaN scores and nearlyEqual floats commit 7e7a10ecd26677b2239149468e24938ce5cc18e1 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:22:16 2015 -0400 Move nearlyEquals() utility function to shared location commit 842222900095df4b27ff3593dbb55a42549f2697 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 18 12:04:35 2015 -0400 Fixup rebase conflicts commit 674f162d7704dd2034b8361358decdefce1f76ce Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:29:35 2015 -0400 [TESTS] Update match and bool tests commit 520380a85456d7137734aed0b06a740e18c9cdec Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:28:09 2015 -0400 Make naming consistent re: plural commit b9221501d839bb24d6db575d08e9bee34043fc65 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:27:39 2015 -0400 Children need to be added to list after serialization commit 05fa51df940c332fbc140517ee56e849f2d40a72 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:22:41 2015 -0400 Re-enable bypass for non-profiled queries commit f132204d264af77a75bd26a02d4e251a19eb411d Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 17 15:21:14 2015 -0400 Fix serialization of QuerySearchResult, InternalProfileResult commit 27b98fd475fc2e9508c91436ef30624bdbee54ba Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Aug 10 17:39:17 2015 -0400 Start to add back tests, refactor Java api commit bcfc9fefd49307045108408dc160774666510e85 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Aug 4 17:08:10 2015 -0400 Checkpoint commit 26a530e0101ce252450eb23e746e48c2fd1bfcae Author: Zachary Tong <zacharyjtong@gmail.com> Date: Tue Jul 14 13:30:32 2015 -0400 Add createWeight() checkpoint commit f0dd61de809c5c13682aa213c0be65972537a0df Author: Zachary Tong <zacharyjtong@gmail.com> Date: Mon Jul 13 12:36:27 2015 -0400 checkpoint commit 377ee8ce5729b8d388c4719913b48fae77a16686 Author: Zachary Tong <zacharyjtong@gmail.com> Date: Wed Mar 18 10:45:01 2015 -0400 checkpoint
2015-12-17 12:05:43 -05:00
public Profilers getProfilers() {
return profilers;
}
public void setProfilers(Profilers profilers) {
this.profilers = profilers;
}
@Override
public void setTask(SearchShardTask task) {
this.task = task;
}
@Override
public SearchShardTask getTask() {
return task;
}
@Override
public boolean isCancelled() {
return task.isCancelled();
}
}