summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/suggest
AgeCommit message (Collapse)Author
2017-07-03Remove QueryParseContext (#25486)Christoph Büscher
QueryParseContext is currently only used as a wrapper for an XContentParser, so this change removes it entirely and changes the appropriate APIs that use it so far to only accept a parser instead.
2017-06-29Remove QueryParseContext from parsing QueryBuilders (#25448)Christoph Büscher
Currently QueryParseContext is only a thin wrapper around an XContentParser that adds little functionality of its own. I provides helpers for long deprecated field names which can be removed and two helper methods that can be made static and moved to other classes. This is a first step in helping to remove QueryParseContext entirely.
2017-06-22Upgrade to lucene-7.0.0-snapshot-ad2cb77. (#25349)Adrien Grand
Most notable changes: - better update concurrency: LUCENE-7868 - TopDocs.totalHits is now a long: LUCENE-7872 - QueryBuilder does not remove the boolean query around multi-term synonyms: LUCENE-7878 - removal of Fields: LUCENE-7500 For the `TopDocs.totalHits` change, this PR relies on the fact that the encoding of vInts and vLongs are compatible: you can write and read with any of them as long as the value can be represented by a positive int.
2017-06-17[Tests] Check that parsing aggregations works in a forward compatible way ↵Christoph Büscher
(#25219) This change adds tests for the aggregation parsing that try to simulate that we can parse existing aggregations in a forward compatible way in the future, ignoring potential newly added fields or substructures to the xContent response.
2017-06-02Scripting: Convert CompiledTemplate to a ScriptContext (#25032)Ryan Ernst
This commit creates TemplateScript and associated classes so that templates no longer need a special ScriptService.compileTemplate method. The execute() method is equivalent to the old run() method. relates #20426
2017-05-31Fix context suggester to read values from keyword type field (#24200)Masaru Hasegawa
Closes #24129
2017-05-25Scripting: Move context definitions to instance type classes (#24883)Ryan Ernst
This is a simple refactoring to move the context definitions into the type that they use. While we have multiple context names for the same class at the moment, this will eventually become one ScriptContext per instance type, so the pattern of a static member on the interface called CONTEXT can be used. This commit also moves the consolidated list of contexts provided by core ES into ScriptModule.
2017-05-24Scripting: Add instance and compiled classes to script contexts (#24868)Ryan Ernst
This commit modifies the compile method of ScriptService to be context aware. The ScriptContext is now a generic class which contains both the instance type and compiled type for a script. Instance type may be stateful (for example, pre loading field information for the index a script will execute on, like in expressions), while the compiled type is stateless and used to construct instance type instances. This change is only a first step to cutover ScriptService to the new paradigm. It only converts callers to the script service, and has a small shim to wrap compilation from the script engines to support the current two fixed instance types, SearchScript and ExecutableScript.
2017-05-22Scripting: Simplify ScriptContext (#24818)Ryan Ernst
As we work towards contexts implying the return type of compilation, we first need ScriptContext to not be an enum. This commit removes the Standard enum and Plugin subclass of ScriptContext.
2017-05-17Add fromXContent method to SearchResponse (#24720)Luca Cavanna
SearchResponse#fromXContent allows to parse a search response, including search hits, aggregations, suggestions and profile results. Only the aggs that we can parse today are supported (which means all of them but a couple that are left to support). SearchResponseTests reuses the existing test infra to randomize aggregations, suggestions and profile response. Relates to #23331
2017-05-16Merge branch 'master' into feature/client_aggs_parsingChristoph Büscher
2017-05-15Scripts: Convert template script engines to return String instead of ↵Ryan Ernst
BytesReference (#24447) Template script engines (mustache, the only one) currently return a BytesReference that users must know is utf8 encoded. This commit modifies all callers and mustache to have the template engine return String. This is much simpler, and does not require decoding in order to use (for example, in ingest).
2017-05-15Merge branch 'master' into feature/client_aggs_parsingChristoph Büscher
Conflicts: core/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilterTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/global/InternalGlobalTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/missing/InternalMissingTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/InternalNestedTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/nested/InternalReverseNestedTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/sampler/InternalSamplerTests.java modules/parent-join/src/test/java/org/elasticsearch/join/aggregations/InternalChildrenTests.java test/framework/src/main/java/org/elasticsearch/search/aggregations/InternalSingleBucketAggregationTestCase.java
2017-05-15Replace manual copying an array or collection with static methods calls (#24657)Koen De Groote
2017-05-12Merge branch 'master' into feature/client_aggs_parsingChristoph Büscher
Conflicts: core/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java core/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java
2017-05-11Make a few class level fields staticKoen De Groote
This commit converts some final constant instance fields to class fields.
2017-05-05Merge remote-tracking branch 'origin/master' into feature/client_aggs_parsingTanguy Leroux
2017-05-04Add StreamInput.readEnum and StreamOutput.writeEnum (#24475)Igor Motov
Implements the common enum serialization/deserialization pattern for enumeration on the StreamInput/StreamOutput.
2017-05-03Add parsing methods for InternalDateHistogram and InternalHistogram (#24213)Tanguy Leroux
2017-04-24Provide informative error message in case of unknown suggestion context. ↵Nilabh Sagar
(#24241) Provide a list of available contexts when you send an unknown context to the completion suggester.
2017-04-21Add utility method to parse named XContent objects with typed prefix (#24240)Tanguy Leroux
This commit adds a XContentParserUtils.parseTypedKeysObject() method that can be used to parse named XContent objects identified by a field name containing a type identifier, a delimiter and the name of the object to parse.
2017-04-18Upgrade to a Lucene 7 snapshot (#24089)Adrien Grand
We want to upgrade to Lucene 7 ahead of time in order to be able to check whether it causes any trouble to Elasticsearch before Lucene 7.0 gets released. From a user perspective, the main benefit of this upgrade is the enhanced support for sparse fields, whose resource consumption is now function of the number of docs that have a value rather than the total number of docs in the index. Some notes about the change: - it includes the deprecation of the `disable_coord` parameter of the `bool` and `common_terms` queries: Lucene has removed support for coord factors - it includes the deprecation of the `index.similarity.base` expert setting, since it was only useful to configure coords and query norms, which have both been removed - two tests have been marked with `@AwaitsFix` because of #23966, which we intend to address after the merge
2017-04-12Allow different data types for category in Context suggester (#23491)Nilabh Sagar
The "category" in context suggester could be String, Number or Boolean. However with the changes in version 5 this is failing and only accepting String. This will have problem for existing users of Elasticsearch if they choose to migrate to higher version; as their existing Mapping and query will fail as mentioned in a bug #22358 This PR fixes the above mentioned issue and allows user to migrate seamlessly. Closes #22358
2017-04-10Move aggs CommonFields and TYPED_KEYS_DELIMITER from InternalAggregation to ↵Luca Cavanna
Aggregation (#23987) These will be shared between internal objects and objects exposed through high level REST client, so they should be moved from internal classes.
2017-03-16CompletionSuggestionContext#toQuery() should also consider text if ↵Christoph Büscher
prefix/regex missing (#23451) In cases where the user specifies only the `text` option on the top level suggest element (either via REST or the java api), this gets transferred to the `text` property in the SuggestionSearchContext. CompletionSuggestionContext currently requires prefix or regex to be specified, otherwise errors. We should use the global `text` property as a fallback if neither prefix nor regex is provided. Closes to #23340
2017-02-27Upgrade to lucene-6.5.0-snapshot-d00c5ca (#23385)Jim Ferenczi
Lucene upgrade
2017-02-27Convert suggestion response parsing to use NamedXContentRegistry (#23355)Luca Cavanna
We recently added parsing code to parse suggesters responses into java api objects. This was done using a switch based on the type of the returned suggestion. We can now replace the switch with using NamedXContentRegistry, which will also be used for aggs parsing.
2017-02-20Adding fromXContent to Suggest and Suggestion class (#23226)Christoph Büscher
A follow up to #23202, this adds parsing from xContent and tests to the four Suggestion implementations and the top level suggest element to be used later when parsing the entire SearchResponse.
2017-02-16Adding fromXContent to Suggestion.Entry and subclasses (#23202)Christoph Büscher
This adds parsing from xContent to Suggestion.Entry and its subclasses for Terms-, Phrase- and CompletionSuggestion.Entry.
2017-02-15Add xcontent parsing to completion suggestion option (#23071)Christoph Büscher
This adds parsing from xContent to the CompletionSuggestion.Entry.Option. The completion suggestion option also inlines the xContent rendering of the containes SearchHit, so in order to reuse the SearchHit parser this also changes the way SearchHit is parsed from using a loop-based parser to using a ConstructingObjectParser that creates an intermediate map representation and then later uses this output to create either a single SearchHit or use it with additional fields defined in the parser for the completion suggestion option.
2017-02-10Use `typed_keys` parameter to prefix suggester names by type in search ↵Tanguy Leroux
responses (#23080) This pull request reuses the typed_keys parameter added in #22965, but this time it applies it to suggesters. When set to true, the suggester names in the search response will be prefixed with a prefix that reflects their type.
2017-02-09Remove getDefaultScriptingLanguage from QueryParseContext (#23043)Luca Cavanna
The method is not needed anymore, was needed only when we supported setting a legacy default lang, which was removed with #21607 Relates to #21607
2017-02-08Add xcontent parsing to suggestion options (#23018)Christoph Büscher
This adds parsing from xContent to Suggestion.Entry.Option and Termsuggestion.Entry.Option.
2017-02-08Fold InternalSearchHits and friends into their interfaces (#23042)Simon Willnauer
We have a bunch of interfaces that have only a single implementation for 6 years now. These interfaces are pretty useless from a SW development perspective and only add unnecessary abstractions. They also require lots of casting in many places where we expect that there is only one concrete implementation. This change removes the interfaces, makes all of the classes final and removes the duplicate `foo` `getFoo` accessors in favor of `getFoo` from these classes.
2017-02-06Remove GeoPointFieldMapper abstractionNicholas Knize
In order to support the evolving GeoPoint encodings in Lucene 5 and 6, ES 2.x and 5.x implements an abstraction layer to the GeoPointFieldMapper classes. As of 5.x the geo_point field mapper settled on using Lucene's more performant LatLonPoint field type and deprecated all other encodings. In 6.0 all encodings except LatLonPoint have been removed rendering this abstraction layer useless. This commit removes the abstraction layer and renames the LatLonPointFieldMapper back to GeoPointFieldMapper to mantain consistency with ES field naming.
2017-02-03Upgrade checkstyle to version 7.5Jason Tedor
This commit upgrades the checkstyle configuration from version 5.9 to version 7.5, the latest version as of today. The main enhancement obtained via this upgrade is better detection of redundant modifiers. Relates #22960
2017-01-12Remove ParseFieldMatcher usages from QueryParseContextjavanna
2017-01-09Replace Suggesters with namedObject (#22491)Nik Everett
Removes another parser registery type thing in favor of `XContentParser#namedObject`.
2017-01-05remove ParseFieldMatcher usages from suggestersjavanna
2017-01-05remove ParseFieldMatcher usages from Script parsing codejavanna
2017-01-05remove unused ParseFieldMatcher imports/argumentsjavanna
2016-12-31Remove unused ParseFieldMatcher#match methodjavanna
2016-12-31Remove some usages of ParseFieldMatcher in favour of using ParseField directlyjavanna
Relates to #19552 Relates to #22130
2016-12-30Remove some more usages of ParseFieldMatcher in favour of using ParseField ↵javanna
directly Relates to #19552 Relates to #22130
2016-12-30Remove some more usages of ParseFieldMatcher in favour of using ParseField ↵javanna
directly Relates to #19552 Relates to #22130
2016-12-20Introduce XContentParser#namedObject (#22003)Nik Everett
Introduces `XContentParser#namedObject which works a little like `StreamInput#readNamedWriteable`: on startup components register parsers under names and a superclass. At runtime we look up the parser and call it to parse the object. Right now the parsers take a context object they use to help with the parsing but I hope to be able to eliminate the need for this context as most what it is used for at this point is to move around parser registries which should be replaced by this method eventually. I make no effort to do so in this PR because it is big enough already. This is meant to the a start down a road that allows us to remove classes like `QueryParseContext`, `AggregatorParsers`, `IndicesQueriesRegistry`, and `ParseFieldRegistry`. The goal here is to reduce the amount of plumbing required to allow parsing pluggable things. With this you don't have to pass registries all over the place. Instead you must pass a super registry to fewer places and use it to wrap the reader. This is the same tradeoff that we use for NamedWriteable and it allows much, much simpler binary serialization. We think we want that same thing for xcontent serialization. The only parsing actually converted to this method is parsing `ScoreFunctions` inside of `FunctionScoreQuery`. I chose this because it is relatively self contained.
2016-12-20SuggestionBuilder doesn't need to extend ToXContentToBytesChristoph Büscher
This changes the class from extending the abstract class to implementing the ToXContent interface only. The former could lead to unexpected behaviour when trying to display the object, since the "toString()" method inherited from ToXContentToBytes would create an error message because the SuggestionBuilders toXContent() methods don't render complete json objects.
2016-12-17Cleanup random stats serialization code (#22223)Simon Willnauer
Some of our stats serialization code duplicates complicated seriazliation logic or could use existing building blocks from StreamOutput/Input. This commit cleans up some of the serialization code.
2016-12-16Remove deprecated _suggest endpoint (#22203)Areek Zillur
In #20305, _suggest endpoint was deprecated in favour of using _search endpoint. This commit removes the dedicated _suggest endpoint entirely from master.
2016-12-12Remove support for empty queries (#22092)Luca Cavanna
Our query DSL supports empty queries (`{}`), which have a different meaning depending on the query that holds it, either ignored, match_all or match_none. We deprecated the support for empty queries in 5.0, where we log a deprecation warning wherever they are used. The way we supported it once we moved query parsing to the coordinating node was having an Optional<QueryBuilder> return type in all of our parse methods (called fromXContent). See #17624. The central place for this was QueryParseContext#parseInnerQueryBuilder. We can now remove all the optional return types and simply throw an exception whenever an empty query is found.