Commit Graph

4411 Commits

Author SHA1 Message Date
Martijn van Groningen fc13499ff5 Added `sort_mode` option that defines what value to pick in the case the sort field is multi-valued.
The `min` and `max` sort modes are supported for all field types. Either the lowest value or the highest value is picked. In addition to that number based fields also support `sum` and `avg` as sort mode. If `sum` sort mode is used then all the values for a field and belonging to a document are added together and the result of that is used as sort value. If the `avg` sort mode is used then the average of all values for the sort field belonging to that document is used as sort value.

Relates to #2634
2013-02-12 20:38:24 +01:00
Shay Banon 7d13545e33 delete indices before running the tests 2013-02-12 19:28:48 +01:00
Shay Banon 668bcd0eb7 Bulk execution while a shard is replication might send erroneous version conflict failures for certain items
fixes #2642
2013-02-12 17:38:06 +01:00
Simon Willnauer a7bbab7e87 # Rescore Feature
The rescore feature allows te rescore a document returned by a query based
on a secondary algorithm. Rescoring is commonly used if a scoring algorithm
is too costly to be executed across the entire document set but efficient enough
to be executed on the Top-K documents scored by a faster retrieval method. Rescoring
can help to improve precision by reordering a larger Top-K window than actually
returned to the user. Typically is it executed on a window between 100 and 500 documents
while the actual result window requested by the user remains the same.

# Query Rescorer

The `query` rescorer executes a secondary query only on the Top-K results of the actual
user query and rescores the documents based on a linear combination of the user query's score
and the score of the `rescore_query`. This allows to execute any exposed query as a
`rescore_query` and supports a `query_weight` as well as a `rescore_query_weight` to weight the
factors of the linear combination.

# Rescore API

The `rescore` request is defined along side the query part in the json request:

```json
curl -s -XPOST 'localhost:9200/_search' -d {
  "query" : {
    "match" : {
      "field1" : {
        "query" : "the quick brown",
        "type" : "boolean",
        "operator" : "OR"
      }
    }
  },
  "rescore" : {
    "window_size" : 50,
    "query" : {
      "rescore_query" : {
        "match" : {
          "field1" : {
            "query" : "the quick brown",
            "type" : "phrase",
            "slop" : 2
          }
        }
      },
      "query_weight" : 0.7,
      "rescore_query_weight" : 1.2
    }
  }
}
```

Each `rescore` request is executed on a per-shard basis within the same roundtrip. Currently the rescore API
has only one implementation (the `query` rescorer) which modifies the result set in-place. Future developments
could include dedicated rescore results if needed by the implemenation ie. a pair-wise reranker.
*Note:* Only regualr queries are rescored, if the search type is set to `scan` or `count` rescorers are not executed.

Closes #2640
2013-02-12 17:10:00 +01:00
Shay Banon c65aff7775 Index with no replicas might loose on going documents while relocating a shard
fixes #26421
2013-02-12 17:03:28 +01:00
Martijn van Groningen e54f010a4d Also support camel case notation for minimal norwegian. 2013-02-12 16:39:11 +01:00
morsegel ca7920a398 added norwegian minimal stemmer 2013-02-12 16:32:38 +01:00
Igor Motov f98bd654a8 Fix filter cache stats calculation
Fixes #2609
2013-02-11 10:28:53 -05:00
uboness a2b87e28f6 fixed a bug in PrioritizedThreadPoolExecutor:
now execute(Runnable) satisfies the priority and fifo nature of same-priority runnables
2013-02-09 04:20:16 +01:00
uboness eef3610e12 fixed a bug in PrioritizedThreadPoolExecutor:
now execute(Runnable) verifies the command is added as Comparable
2013-02-09 03:33:12 +01:00
uboness 678a8664f6 fixed a bug in PrioritizedThreadPoolExecutor:
now execute(Runnable) verifies the command is added as PrioritizedRunnable
2013-02-09 03:26:52 +01:00
uboness 6d9048f8cc added priority support for cluster state updates:
* URGENT:
    * cluster_reroute (api)
    * refresh-mapping
    * cluster_update_settings
    * reroute_after_cluster_update_settings
    * create-index
    * delete-index
    * index-aliases
    * remove-index-template
    * create-index-template
    * update-mapping
    * remove-mapping
    * put-mapping
    * open-index
    * close-index
    * update-settings

* HIGH
    * routing-table-updater
    * zen-disco-node_left
    * zen-disco-master_failed
    * shard-failed
    * shard-started

* NORMAL
    * all other actions
2013-02-09 01:14:57 +01:00
Simon Willnauer f5331c9535 Cleanup NumericFieldData. FieldData interfaces are reduced to long and double while internal
represenations still operate on the actual datatypes.
2013-02-08 20:58:36 +01:00
Martijn van Groningen 1189a2c2c2 Extended mv sorting integration test 2013-02-08 15:24:56 +01:00
Martijn van Groningen 8c7779057c Added sort by field that have multiple values per document.
Closes #2634
2013-02-08 13:28:40 +01:00
Simon Willnauer 033d6e4306 don't use substraction for comparison if datatypes can overflow 2013-02-08 10:07:31 +01:00
Martijn van Groningen f97021b165 Fixes size assertion failure. 2013-02-07 16:50:54 +01:00
Martijn van Groningen e2cb7edb08 Added more info to assert 2013-02-07 13:52:25 +01:00
Martijn van Groningen e72e323c8a Attempt to fix "No active shards" failure 2013-02-07 10:14:10 +01:00
Lee Hinman ed43ad07d7 Throw a more meaningful message when no document is specified for indexing 2013-02-06 22:33:02 +01:00
Florian Schilling a52e01f3e5 Remove XTermsFilter and UidFilter in favour of Lucene 4.1 TermsFilter 2013-02-06 18:45:05 +01:00
Igor Motov 6890c9fa62 Move action.wait_on_mapping_change setting to pom 2013-02-06 11:48:58 -05:00
Igor Motov ed09ba0a18 Improve stability of RecoveryPercolatorTests
Without "action.wait_on_mapping_change" setting set to true, the test node might get shutdown before updated mapping is saved.
2013-02-05 14:53:46 -05:00
Igor Motov 8277833f8d Fix settings processing in WordDelimiterTokenFilterFactory 2013-02-05 10:03:00 -05:00
Martijn van Groningen 19295280d9 Made sure that wrapped child query / parent query gets rewritten only once. 2013-02-05 10:27:31 +01:00
Igor Motov 9e89323ad2 Add proper cleanup to InternalSettingsPerparerTests 2013-02-04 19:58:40 -05:00
Martijn van Groningen bc667c378e Made SoftWrapper fields final. 2013-02-04 14:47:36 +01:00
Martijn van Groningen 8109d13733 Use CacheRecycler when resolving parent docs in TopChildrenQuery. 2013-02-04 12:46:30 +01:00
Martijn van Groningen 9c3a86875b Removed `execution_type` for has_child and has_parent. 2013-02-04 11:37:40 +01:00
Igor Motov 20ce01bd53 Add additional query validation to the terms query parser
Fixes #2608
2013-02-03 09:44:16 -05:00
Shay Banon ebc0c8cc6d when we fix maxMergeAtOnce, make sure to not set it to 1 as its an illegal value 2013-02-01 19:00:01 +01:00
Shay Banon a8c9e580ed add getMaxOrd, and properly document the difference between it and numOrds 2013-02-01 16:13:13 +01:00
Shay Banon 6f1932ab67 support yaml detection on char sequence 2013-02-01 12:46:19 +01:00
Simon Willnauer 6468c15446 check for == 0 rather than > 0 2013-02-01 11:11:47 +01:00
Simon Willnauer c18ae4a194 fix getMemorySizeInBytes in SparseMultiArrayOrdinals 2013-02-01 11:09:09 +01:00
Igor Motov 45b2bff8da Improve SearchStatsTests
Added refresh to guarantee that at least something will be fetched on a fast computer.
2013-01-31 21:19:08 -05:00
Igor Motov ca635deb36 Allow health to be executed on a local node instead of the master 2013-01-31 21:19:08 -05:00
Igor Motov 3c9541dd14 Make facet and sort tests more reliable in case of multiple nodes and shards
Stats, histogram and range facets and sorting currently fail if a field that they are running on is not defined in the mapping. In case of dynamic fields it might mean that by the time the facet query is executed the new field mapping might not be propagated to all nodes yet.
2013-01-31 21:19:07 -05:00
Igor Motov 6a01e7882c Improve shardsCleanup test
When startNode exits there is no guarantee that shard cleanup is finished because the cleanup operation is performed on another thread and startNode doesn't wait for it to complete. Therefore we might need to wait for the shard to disappear.
2013-01-31 21:18:14 -05:00
Igor Motov e32efba3d8 Improve RecoverAfterNodes tests 2013-01-31 20:05:55 -05:00
Martijn van Groningen 5e811e5382 Another small TopChildrenQuery cleanup. 2013-01-31 23:49:32 +01:00
Martijn van Groningen 7ef65688cd - TopChildrenQuery cleanup.
- Added class level jdocs for TopChildrenQuery and ChildrenQuery.
2013-01-31 23:38:09 +01:00
Simon Willnauer 1a1df06411 Move OrdsBuilding into a dedicated class and abstract integer pools used to build sparse ordinals 2013-01-31 19:02:31 +01:00
Martijn van Groningen 1f50b07406 Initial parent/child queries cleanup. 2013-01-31 18:39:31 +01:00
Martijn van Groningen 371b071fb7 Added notion of Rewrite that replaces ScopePhase 2013-01-31 17:24:46 +01:00
Martijn van Groningen d4ef4697d5 Also remove scope from facet builders. Fixes build. 2013-01-31 16:34:45 +01:00
Martijn van Groningen 46dd42920c Remove scope support in query and facet dsl.
Remove support for the `scope` field in facets and `_scope` field in the nested and parent/child queries. The scope support for nested queries will be replaced by the `nested` facet option and a facet filter with a nested filter. The nested filters will now support the a `join` option. Which controls whether to perform the block join. By default this enabled, but when disabled it returns the nested documents as hits instead of the joined root document.

Search request with the current scope support.
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
    "query" : {
		"nested" : {
			"path" : "offers",
			"query" : {
				"match" : {
					"offers.color" : "blue"
				}
			},
			"_scope" : "my_scope"
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "offers.size"
			},
			"scope" : "my_scope"
		}
	}
}'
```

The following will be functional equivalent of using the scope support:
```
curl -s -XPOST 'localhost:9200/products/_search?search_type=count' -d '{
    "query" : {
		"nested" : {
			"path" : "offers",
			"query" : {
				"match" : {
					"offers.color" : "blue"
				}
			}
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "offers.size"
			},
			"facet_filter" : {
				"nested" : {
					"path" : "offers",
					"query" : {
						"match" : {
							"offers.color" : "blue"
						}
					},
					"join" : false
				}
			},
			"nested" : "offers"
		}
	}
}'
```

The scope support for parent/child queries will be replaced by running the child query as filter in a global facet.

Search request with the current scope support:
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
	"query" : {
		"has_child" : {
			"type" : "offer",
			"query" : {
				"match" : {
					"color" : "blue"
				}
			},
			"_scope" : "my_scope"
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "size"
			},
			"scope" : "my_scope"
		}
	}
}'
```

The following is the functional equivalent of using the scope support with parent/child queries:
```
curl -s -XPOST 'localhost:9200/products/_search' -d '{
	"query" : {
		"has_child" : {
			"type" : "offer",
			"query" : {
				"match" : {
					"color" : "blue"
				}
			}
		}
	},
	"facets" : {
		"size" : {
			"terms" : {
				"field" : "size"
			},
			"global" : true,
			"facet_filter" : {
				"term" : {
					"color" : "blue"
				}
			}
		}
	}
}'
```

Closes #2606
2013-01-31 15:09:57 +01:00
Martijn van Groningen 355381962b Use only the 'test' index, instead of all indices for child search benchmark. 2013-01-31 13:12:33 +01:00
Shay Banon 6cec73c201 remove fuzzy factor from mapping (internally implemented)
we want to support ~ notion in query parser for types other than strings, we are getting there, one can do now age:10~5, we would love to support it for dates, as in timestamp:2012-10-10~5d, but that requires changes in the query parser to support strings after the ~ sign
2013-01-31 12:23:03 +01:00
Igor Motov 8df7f2af0d Improve testReusePeerRecovery test 2013-01-30 19:51:41 -05:00