Commit Graph

1397 Commits

Author SHA1 Message Date
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
Igor Motov 29f4274213 Add index cleanup if index creation fails
Fixes #2590
2013-01-30 10:40:01 -05:00
Shay Banon 5c40c97e6e Id Cache: Allow to configure if ids should be reused (memory wise) or not, default to false
closes #2605
2013-01-30 14:42:07 +01:00
Martijn van Groningen bc20f068c9 Made `search_analyzer` updateable via put mapping api.
Closes #2604
2013-01-30 11:49:20 +01:00
Martijn van Groningen e074e00f76 Fielddata: Moved the growing logic to IntArrayRef 2013-01-30 11:20:41 +01:00
Martijn van Groningen f7692aeef2 Fielddata: IntArrayRef is initialized with small array and grows if needed 2013-01-30 10:57:52 +01:00
Simon Willnauer 5df37eaf75 add more advanced tests for phrase_prefix 2013-01-30 10:51:05 +01:00
Shay Banon f5e55b7cb9 properly print JVM version 2013-01-29 20:25:13 +01:00
Shay Banon 0568284147 reduce the memory needed while building the sparse array ordinals 2013-01-29 20:23:54 +01:00
Shay Banon 716f2aebbb add 0.20.5 2013-01-29 10:14:25 +01:00
Simon Willnauer 0697e2f23e use index prefix in tests to prevent misconfiguration 2013-01-28 15:51:06 +01:00
Simon Willnauer 72a2416a8c Support MultiPhrasePrefixQuery and MultiPhraseQuery in highlighters
Closes #2596
2013-01-28 15:41:25 +01:00
Martijn van Groningen 2e68207d6d Updated suggest api.
# Suggest feature
The suggest feature suggests similar looking terms based on a provided text by using a suggester. At the moment there the only supported suggester is `fuzzy`. The suggest feature is available from version `0.21.0`.

# Fuzzy suggester
The `fuzzy` suggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested. The suggested terms are provided per analyzed suggest text token. The `fuzzy` suggester doesn't take the query into account that is part of request.

# Suggest API
The suggest request part is defined along side the query part as top field in the json request.

```
curl -s -XPOST 'localhost:9200/_search' -d '{
  "query" : {
    ...
  },
  "suggest" : {
    ...
  }
}'
```

Several suggestions can be specified per request. Each suggestion is identified with an arbitary name. In the example below two suggestions are requested. Both `my-suggest-1` and `my-suggest-2` suggestions use the `fuzzy` suggester, but have a different `text`.

```
"suggest" : {
  "my-suggest-1" : {
    "text" : "the amsterdma meetpu",
    "fuzzy" : {
      "field" : "body"
    }
  },
  "my-suggest-2" : {
    "text" : "the rottredam meetpu",
    "fuzzy" : {
      "field" : "title",
    }
  }
}
```

The below suggest response example includes the suggestion response for `my-suggest-1` and `my-suggest-2`. Each suggestion part contains entries. Each entry is effectively a token from the suggest text and contains the suggestion entry text, the original start offset and length in the suggest text and if found an arbitary number of options.

```
{
  ...
  "suggest": {
    "my-suggest-1": [
      {
        "text" : "amsterdma",
        "offset": 4,
        "length": 9,
        "options": [
           ...
        ]
      },
      ...
    ],
    "my-suggest-2" : [
      ...
    ]
  }
  ...
}
```

Each options array contains a option object that includes the suggested text, its document frequency and score compared to the suggest entry text. The meaning of the score depends on the used suggester. The fuzzy suggester's score is based on the edit distance.

```
"options": [
  {
    "text": "amsterdam",
    "freq": 77,
    "score": 0.8888889
  },
  ...
]
```

# Global suggest text

To avoid repitition of the suggest text, it is possible to define a global text. In the example below the suggest text is defined globally and applies to the `my-suggest-1` and `my-suggest-2` suggestions.

```
"suggest" : {
  "text" : "the amsterdma meetpu"
  "my-suggest-1" : {
    "fuzzy" : {
      "field" : "title"
    }
  },
  "my-suggest-2" : {
    "fuzzy" : {
      "field" : "body"
    }
  }
}
```

The suggest text can in the above example also be specied as suggestion specific option. The suggest text specified on suggestion level override the suggest text on the global level.

# Other suggest example.

In the below example we request suggestions for the following suggest text: `devloping distibutd saerch engies` on the `title` field with a maximum of 3 suggestions per term inside the suggest text. Note that in this example we use the `count` search type. This isn't required, but a nice optimalization. The suggestions are gather in the `query` phase and in the case that we only care about suggestions (so no hits) we don't need to execute the `fetch` phase.

```
curl -s -XPOST 'localhost:9200/_search?search_type=count' -d '{
  "suggest" : {
    "my-title-suggestions-1" : {
      "text" : "devloping distibutd saerch engies",
      "fuzzy" : {
        "size" : 3,
        "field" : "title"
      }
    }
  }
}'
```

The above request could yield the response as stated in the code example below. As you can see if we take the first suggested options of each suggestion entry we get `developing distributed search engines` as result.

```
{
  ...
  "suggest": {
    "my-title-suggestions-1": [
      {
        "text": "devloping",
        "offset": 0,
        "length": 9,
        "options": [
          {
            "text": "developing",
            "freq": 77,
            "score": 0.8888889
          },
          {
            "text": "deloping",
            "freq": 1,
            "score": 0.875
          },
          {
            "text": "deploying",
            "freq": 2,
            "score": 0.7777778
          }
        ]
      },
      {
        "text": "distibutd",
        "offset": 10,
        "length": 9,
        "options": [
          {
            "text": "distributed",
            "freq": 217,
            "score": 0.7777778
          },
          {
            "text": "disributed",
            "freq": 1,
            "score": 0.7777778
          },
          {
            "text": "distribute",
            "freq": 1,
            "score": 0.7777778
          }
        ]
      },
      {
        "text": "saerch",
        "offset": 20,
        "length": 6,
        "options": [
          {
            "text": "search",
            "freq": 1038,
            "score": 0.8333333
          },
          {
            "text": "smerch",
            "freq": 3,
            "score": 0.8333333
          },
          {
            "text": "serch",
            "freq": 2,
            "score": 0.8
          }
        ]
      },
      {
        "text": "engies",
        "offset": 27,
        "length": 6,
        "options": [
          {
            "text": "engines",
            "freq": 568,
            "score": 0.8333333
          },
          {
            "text": "engles",
            "freq": 3,
            "score": 0.8333333
          },
          {
            "text": "eggies",
            "freq": 1,
            "score": 0.8333333
          }
        ]
      }
    ]
  }
  ...
}
```

# Common suggest options:
* `text` - The suggest text. The suggest text is a required option that needs to be set globally or per suggestion.

# Common fuzzy suggest options
* `field` - The field to fetch the candidate suggestions from. This is an required option that either needs to be set globally or per suggestion.
* `analyzer` - The analyzer to analyse the suggest text with. Defaults to the search analyzer of the suggest field.
* `size` - The maximum corrections to be returned per suggest text token.
* `sort` - Defines how suggestions should be sorted per suggest text term. Two possible value:
** `score` - Sort by sore first, then document frequency and then the term itself.
** `frequency` - Sort by document frequency first, then simlarity score and then the term itself.
* `suggest_mode` - The suggest mode controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. Three possible values can be specified:
** `missing` - Only suggest terms in the suggest text that aren't in the index. This is the default.
** `popular` - Only suggest suggestions that occur in more docs then the original suggest text term.
** `always` - Suggest any matching suggestions based on terms in the suggest text.

# Other fuzzy suggest options:
* `lowercase_terms` - Lower cases the suggest text terms after text analyzation.
* `max_edits` - The maximum edit distance candidate suggestions can have in order to be considered as a suggestion. Can only be a value between 1 and 2. Any other value result in an bad request error being thrown. Defaults to 2.
* `min_prefix` - The number of minimal prefix characters that must match in order be a candidate suggestions. Defaults to 1. Increasing this number improves spellcheck performance. Usually misspellings don't occur in the beginning of terms.
* `min_query_length` -  The minimum length a suggest text term must have in order to be included. Defaults to 4.
* `shard_size` - Sets the maximum number of suggestions to be retrieved from each individual shard. During the reduce phase only the top N suggestions are returned based on the `size` option. Defaults to the `size` option. Setting this to a value higher than the `size` can be useful in order to get a more accurate document frequency for spelling corrections at the cost of performance. Due to the fact that terms are partitioned amongst shards, the shard level document frequencies of spelling corrections may not be precise. Increasing this will make these document frequencies more precise.
* `max_inspections` - A factor that is used to multiply with the `shards_size` in order to inspect more candidate spell corrections on the shard level. Can improve accuracy at the cost of performance. Defaults to 5.
* `threshold_frequency` - The minimal threshold in number of documents a suggestion should appear in. This can be specified as an absolute number or as a relative percentage of number of documents. This can improve quality by only suggesting high frequency terms. Defaults to 0f and is not enabled. If a value higher than 1 is specified then the number cannot be fractional. The shard level document frequencies are used for this option.
* `max_query_frequency` - The maximum threshold in number of documents a sugges text token can exist in order to be included. Can be a relative percentage number (e.g 0.4) or an absolute number to represent document frequencies. If an value higher than 1 is specified then fractional can not be specified. Defaults to 0.01f. This can be used to exclude high frequency terms from being spellchecked. High frequency terms are usually spelled correctly on top of this this also improves the spellcheck performance.  The shard level document frequencies are used for this option.
2013-01-28 15:18:18 +01:00
Simon Willnauer 48488f707f Expose CommonTermsQuery in Match & MultiMatch and enable highlighting
Closes #2591
2013-01-28 11:57:05 +01:00
Shay Banon bfdf8fe590 Indexes created from index request might not replica initial doc to replica
fixes #2594
2013-01-28 11:29:32 +01:00
Shay Banon 9539661d40 move facet reduce from facet process to the actual facet
this will simplify execution, and actually let the process just be a parser (rename will probably happen)
2013-01-27 13:45:38 +01:00
Shay Banon 360d7d9425 default for paged_bytes for string type
less memory overhead, though a bit slower on the execution side for facets, and might require more memory per facet execution
2013-01-26 15:11:14 +01:00
Simon Willnauer 5c89d66216 move ShardsAllocatorModuleTests to o.e.t.integration 2013-01-25 22:26:30 +01:00
Shay Banon 41cfe9cc27 add 0.20.4 2013-01-25 22:02:34 +01:00
Shay Banon 042a5d02d9 Primary shard failure with initializing replica shards can cause the replica shard to cause allocation failures
fixes #2592
2013-01-25 17:59:01 +01:00
Simon Willnauer a7bb3c29f2 Propagate exception during recovery if segement info can not be opended but should 2013-01-25 15:25:48 +01:00
Shay Banon 1be84c273b eagerly reroute when a node leaves the cluster 2013-01-25 15:23:05 +01:00
Martijn van Groningen a1ef1f02cc Exposed IndexOptions#DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS setting. 2013-01-25 00:02:43 +01:00
Shay Banon 45ed9ddba7 cleanup ordinals in field data 2013-01-24 22:31:52 +01:00
Shay Banon 990acff4f7 make sure we wait for yellow stats in suggest API when searching on clean index 2013-01-24 22:31:51 +01:00
Martijn van Groningen f974a17229 Removed AbstractFragmentsBuilder. Lucene's BaseFragmentsBuilder has now discrete multivalued highlighting and better support for requesting large number of fragments. 2013-01-24 22:15:07 +01:00
Martijn van Groningen e56b279624 Made BlockJoinScorer#freq() method handle freqs correctly (as is done in ToParentBlockJoinQuery) 2013-01-24 21:52:56 +01:00
Martijn van Groningen 9013eeae8a Added filter support in the `has_child` and `has_parent` filters.
Example:
```
curl -XPOST 'localhost:9200/_search' -d '{
  "query": {
    "filtered_query": {
      "query": {
        "match": {
          "title": "distributed systems"
        }
      },
      "filter": {
        "has_child": {
          "type": "tag",
          "filter": {
            "term": {
              "name": "book"
            }
          }
        }
      }
    }
  }
}'
```

Closes #2585
2013-01-24 21:32:38 +01:00
Shay Banon a39469a252 gather the field data that are changed
(we will make use of that later)
2013-01-24 15:55:23 +01:00
Martijn van Groningen 98a674fc6e Added suggest api.
# Suggest feature
The suggest feature suggests similar looking terms based on a provided text by using a suggester. At the moment there the only supported suggester is `fuzzy`. The suggest feature is available since version `0.21.0`.

# Fuzzy suggester
The `fuzzy` suggester suggests terms based on edit distance. The provided suggest text is analyzed before terms are suggested. The suggested terms are provided per analyzed suggest text token. The `fuzzy` suggester doesn't take the query into account that is part of request.

# Suggest API
The suggest request part is defined along side the query part as top field in the json request.

```
curl -s -XPOST 'localhost:9200/_search' -d '{
    "query" : {
        ...
    },
    "suggest" : {
        ...
    }
}'
```

Several suggestions can be specified per request. Each suggestion is identified with an arbitary name. In the example below two suggestions are requested. The `my-suggest-1` suggestion uses the `body` field and `my-suggest-2` uses the `title` field. The `type` field is a required field and defines what suggester to use for a suggestion.

```
"suggest" : {
    "suggestions" : {
        "my-suggest-1" : {
            "type" : "fuzzy",
            "field" : "body",
            "text" : "the amsterdma meetpu"
        },
        "my-suggest-2" : {
            "type" : "fuzzy",
            "field" : "title",
            "text" : "the rottredam meetpu"
        }
    }
}
```

The below suggest response example includes the suggestions part for `my-suggest-1` and `my-suggest-2`. Each suggestion part contains a terms array, that contains all terms outputted by the analyzed suggest text. Each term object includes the term itself, the original start and end offset in the suggest text and if found an arbitary number of suggestions.

```
{
    ...
    "suggest": {
        "my-suggest-1": {
            "terms" : [
              {
                "term" : "amsterdma",
                "start_offset": 5,
                "end_offset": 14,
                "suggestions": [
                   ...
                ]
              }
              ...
            ]
        },
        "my-suggest-2" : {
          "terms" : [
            ...
          ]
        }
    }
```

Each suggestions array contains a suggestion object that includes the suggested term, its document frequency and score compared to the suggest text term. The meaning of the score depends on the used suggester. The fuzzy suggester's score is based on the edit distance.

```
"suggestions": [
    {
        "term": "amsterdam",
        "frequency": 77,
        "score": 0.8888889
    },
    ...
]
```

# Global suggest text

To avoid repitition of the suggest text, it is possible to define a global text. In the example below the suggest text is a global option and applies to the `my-suggest-1` and `my-suggest-2` suggestions.

```
"suggest" : {
    "suggestions" : {
        "text" : "the amsterdma meetpu",
        "my-suggest-1" : {
            "type" : "fuzzy",
            "field" : "title"
        },
        "my-suggest-2" : {
            "type" : "fuzzy",
            "field" : "body"
        }
    }
}
```

The suggest text can be specied as global option or as suggestion specific option. The suggest text specified on suggestion level override the suggest text on the global level.

# Other suggest example.

In the below example we request suggestions for the following suggest text: `devloping distibutd saerch engies` on the `title` field with a maximum of 3 suggestions per term inside the suggest text. Note that in this example we use the `count` search type. This isn't required, but a nice optimalization. The suggestions are gather in the `query` phase and in the case that we only care about suggestions (so no hits) we don't need to execute the `fetch` phase.

```
curl -s -XPOST 'localhost:9200/_search?search_type=count' -d '{
  "suggest" : {
      "suggestions" : {
        "my-title-suggestions" : {
          "suggester" : "fuzzy",
          "field" : "title",
          "text" : "devloping distibutd saerch engies",
          "size" : 3
        }
      }
  }
}'
```

The above request could yield the response as stated in the code example below. As you can see if we take the first suggested term of each suggest text term we get `developing distributed search engines` as result.

```
{
  ...
  "suggest": {
    "my-title-suggestions": {
      "terms": [
        {
          "term": "devloping",
          "start_offset": 0,
          "end_offset": 9,
          "suggestions": [
            {
              "term": "developing",
              "frequency": 77,
              "score": 0.8888889
            },
            {
              "term": "deloping",
              "frequency": 1,
              "score": 0.875
            },
            {
              "term": "deploying",
              "frequency": 2,
              "score": 0.7777778
            }
          ]
        },
        {
          "term": "distibutd",
          "start_offset": 10,
          "end_offset": 19,
          "suggestions": [
            {
              "term": "distributed",
              "frequency": 217,
              "score": 0.7777778
            },
            {
              "term": "disributed",
              "frequency": 1,
              "score": 0.7777778
            },
            {
              "term": "distribute",
              "frequency": 1,
              "score": 0.7777778
            }
          ]
        },
        {
          "term": "saerch",
          "start_offset": 20,
          "end_offset": 26,
          "suggestions": [
            {
              "term": "search",
              "frequency": 1038,
              "score": 0.8333333
            },
            {
              "term": "smerch",
              "frequency": 3,
              "score": 0.8333333
            },
            {
              "term": "serch",
              "frequency": 2,
              "score": 0.8
            }
          ]
        },
        {
          "term": "engies",
          "start_offset": 27,
          "end_offset": 33,
          "suggestions": [
            {
              "term": "engines",
              "frequency": 568,
              "score": 0.8333333
            },
            {
              "term": "engles",
              "frequency": 3,
              "score": 0.8333333
            },
            {
              "term": "eggies",
              "frequency": 1,
              "score": 0.8333333
            }
          ]
        }
      ]
    }
  }
  ...
}
```

# Common suggest options:
* `suggester` - The suggester implementation type. The only supported value is 'fuzzy'. This is a required option.
* `text` - The suggest text. The suggest text is a required option that needs to be set globally or per suggestion.

# Common fuzzy suggest options
* `field` - The field to fetch the candidate suggestions from. This is an required option that either needs to be set globally or per suggestion.
* `analyzer` - The analyzer to analyse the suggest text with. Defaults to the search analyzer of the suggest field.
* `size` - The maximum corrections to be returned per suggest text token.
* `sort` - Defines how suggestions should be sorted per suggest text term. Two possible value:
** `score` - Sort by sore first, then document frequency and then the term itself.
** `frequency` - Sort by document frequency first, then simlarity score and then the term itself.
* `suggest_mode` - The suggest mode controls what suggestions are included or controls for what suggest text terms, suggestions should be suggested. Three possible values can be specified:
** `missing` - Only suggest terms in the suggest text that aren't in the index. This is the default.
** `popular` - Only suggest suggestions that occur in more docs then the original suggest text term.
** `always` - Suggest any matching suggestions based on terms in the suggest text.

# Other fuzzy suggest options:
* `lowercase_terms` - Lower cases the suggest text terms after text analyzation.
* `max_edits` - The maximum edit distance candidate suggestions can have in order to be considered as a suggestion. Can only be a value between 1 and 2. Any other value result in an bad request error being thrown. Defaults to 2.
* `min_prefix` - The number of minimal prefix characters that must match in order be a candidate suggestions. Defaults to 1. Increasing this number improves spellcheck performance. Usually misspellings don't occur in the beginning of terms.
* `min_query_length` -  The minimum length a suggest text term must have in order to be included. Defaults to 4.
* `shard_size` - Sets the maximum number of suggestions to be retrieved from each individual shard. During the reduce phase only the top N suggestions are returned based on the `size` option. Defaults to the `size` option. Setting this to a value higher than the `size` can be useful in order to get a more accurate document frequency for spelling corrections at the cost of performance. Due to the fact that terms are partitioned amongst shards, the shard level document frequencies of spelling corrections may not be precise. Increasing this will make these document frequencies more precise.
* `max_inspections` - A factor that is used to multiply with the `shards_size` in order to inspect more candidate spell corrections on the shard level. Can improve accuracy at the cost of performance. Defaults to 5.
* `threshold_frequency` - The minimal threshold in number of documents a suggestion should appear in. This can be specified as an absolute number or as a relative percentage of number of documents. This can improve quality by only suggesting high frequency terms. Defaults to 0f and is not enabled. If a value higher than 1 is specified then the number cannot be fractional. The shard level document frequencies are used for this option.
* `max_query_frequency` - The maximum threshold in number of documents a sugges text token can exist in order to be included. Can be a relative percentage number (e.g 0.4) or an absolute number to represent document frequencies. If an value higher than 1 is specified then fractional can not be specified. Defaults to 0.01f. This can be used to exclude high frequency terms from being spellchecked. High frequency terms are usually spelled correctly on top of this this also improves the spellcheck performance.  The shard level document frequencies are used for this option.

 Closes #2585
2013-01-24 15:41:06 +01:00
Shay Banon 9673a1c366 expose field data settings in mapping, they can be updated using merge mapping 2013-01-24 15:33:24 +01:00
Simon Willnauer 4eefcb9c82 Expose CommonTermsQuery
Closes #2583
2013-01-24 14:18:01 +01:00
Simon Willnauer c4eab90b2e Cleanup MatchQuery 2013-01-24 14:11:56 +01:00
Shay Banon c2f35621f6 allow to get settings as delimited string 2013-01-24 12:03:16 +01:00
Shay Banon b143822bac allow to load settings from delimited string 2013-01-24 12:00:14 +01:00
Simon Willnauer 88f68264c7 Reuse MemoryIndex instances across Percolator requests.
* added configurable MemoryIndexPool that pools MemoryIndex instance across Threads
* Pool can be configured based on the number of pooled instances as well as the maximum number of bytes that is reused across the pooled instances

Closes #2581
2013-01-24 11:53:21 +01:00
Shay Banon e8c1180ede add field data stats 2013-01-24 11:38:18 +01:00
Shay Banon 613b746299 move field data type to simply be type and settings 2013-01-24 09:33:16 +01:00
Martijn van Groningen 50ac477d92 Fixed small bug. Index name should be used to lookup entry. 2013-01-23 23:53:20 +01:00
Shay Banon 4967a97faf don't use private since its accessed from inner class, remove $$ need 2013-01-23 22:17:27 +01:00
Martijn van Groningen 346422b747 Added sparse multi ordinals implementation for field data. 2013-01-23 22:11:31 +01:00
Daniel Muller 9e79f54cb1 Check for java-6-openjdk-amd64 2013-01-23 18:34:37 +01:00
synhershko e0f711a94a Updating Lucene version 2013-01-23 16:18:18 +02:00
Shay Banon a74e7f8099 refactor geo to extract common classes 2013-01-23 14:14:21 +01:00
Simon Willnauer 9c729fad2c remove flush check IW#commit always adds a commit point now even if nothing has changed ie. docs are added, updated or deleted. 2013-01-23 14:06:01 +01:00
Shay Banon 22f0e79a84 use merge trigger to control when to do merges
now with merge trigger, we can simply decide when to do merges based on it
2013-01-23 13:24:20 +01:00
Shay Banon d969e61999 Remove settings option for index store compression, compression is always enabled
closes #2577
2013-01-23 13:11:48 +01:00
Simon Willnauer 2880cd0172 Upgrade to Lucene 4.1
* Removed CustmoMemoryIndex in favor of MemoryIndex which as of 4.1 supports adding the same field twice
* Replaced duplicated logic in X[*]FSDirectory for rate limiting with a RateLimitedFSDirectory wrapper
* Remove hacks to find out merge context in rate limiting in favor of IOContext
* replaced Scorer#freq() return type (from float to int)
* Upgraded FVHighlighter to new 'centered' highlighting
* Fixed RobinEngine to use seperate setCommitData
2013-01-23 11:54:11 +01:00
Shay Banon 20f43bf54c add hasSingleArrayBackingStorage
allow for optimization only when there really is a single array, and not when there is a multi dimensional one
2013-01-23 10:24:43 +01:00
Igor Motov bbfd3957eb Improve stability of the testNodesInfos test 2013-01-22 12:29:38 -05:00
Igor Motov 9becdb814a Improve stability of the shardsCleanup test 2013-01-22 10:20:18 -05:00
Shay Banon c295211a85 final move to new field data 2013-01-22 16:16:33 +01:00
Shay Banon 27bfb341ff better logging on missing format, and allow to configure format on a type on the index level 2013-01-22 16:16:33 +01:00
uboness 09cc70b8c9 added predefined empty implementation for all atomic field datas 2013-01-22 16:16:33 +01:00
Shay Banon 6b92b592b4 allow to clear by reader the new field data cache 2013-01-22 16:16:32 +01:00
Shay Banon c67386f644 properly invalidate on core closed reader 2013-01-22 16:16:32 +01:00
Shay Banon af757fd821 more usage of field data
note, removed field data from cache stats, it will have its own stats later on (cache part is really misleading)
2013-01-22 16:16:32 +01:00
Shay Banon de013babf8 move geo filters and numeric range to use new field data 2013-01-22 16:16:32 +01:00
Shay Banon be1e5becbb move scripts to use new field data 2013-01-22 16:16:32 +01:00
Shay Banon 772ee9db54 move terms to use new field data 2013-01-22 16:16:32 +01:00
Shay Banon e5b651321f remove some safe methods because of the new makeSafe method usage 2013-01-22 16:16:32 +01:00
Shay Banon f189a832c5 grr pages -> paged 2013-01-22 16:16:32 +01:00
Shay Banon 5b7173fc35 move sorting to work with new field data 2013-01-22 16:16:32 +01:00
uboness b739bf97d4 added missing dedicated value comparators for the different indices field data 2013-01-22 16:16:32 +01:00
Shay Banon 45f27fe96a add packed bytes variant for strings/bytes 2013-01-22 16:16:32 +01:00
uboness 855b64a8a7 byte field data implementation 2013-01-22 16:16:31 +01:00
uboness f1f3c241fd short field data implementation 2013-01-22 16:16:31 +01:00
uboness 3840439365 float field data implementation 2013-01-22 16:16:31 +01:00
Shay Banon 9137fcc6fc move geo distance sorting to use new field data 2013-01-22 16:16:31 +01:00
Shay Banon d5e70a27df integer type to support int field data type 2013-01-22 16:16:31 +01:00
uboness fc09ce7ac9 Implemented int field data 2013-01-22 16:16:31 +01:00
Shay Banon d82859c82b geo point new field mapper with geo distance facet based impl 2013-01-22 16:16:31 +01:00
Shay Banon 2e86081f7b use smartNameMapper on context 2013-01-22 16:16:31 +01:00
Shay Banon d88e3f73ac add specific makeSafe method to make an unsafe (shared) bytes based value to a "safe" one 2013-01-22 16:16:31 +01:00
Shay Banon 1765b0b813 date histogram to use new field data 2013-01-22 16:16:31 +01:00
Shay Banon 37acba1b57 terms stats to use new field data 2013-01-22 16:16:31 +01:00
Shay Banon f1f86efed5 move statistical facet to use new field data 2013-01-22 16:16:30 +01:00
Shay Banon 699ff2782e move histogram facet to use new field data 2013-01-22 16:16:30 +01:00
Shay Banon 8c7e0f5ca1 fix getOrds on single array ords 2013-01-22 16:16:30 +01:00
Shay Banon fa363b2dca move range facet to use new field data abstraction 2013-01-22 16:16:30 +01:00
Shay Banon 692413862a add clear when deleting an index for the field data service 2013-01-22 16:16:30 +01:00
Shay Banon a39ca58de9 add field data service to index level services 2013-01-22 16:16:30 +01:00
Shay Banon 2d91939253 add initial field data type support to mappers
hardwired and still happily leaves with current field data impl
2013-01-22 16:16:30 +01:00
Shay Banon e0b280f9b3 use FieldMapper.Names for fieldNames, and not just fieldName as string 2013-01-22 16:16:30 +01:00
Shay Banon 7dc5cf9799 add long field support 2013-01-22 16:16:30 +01:00
Shay Banon 7397007e05 initial commit 2013-01-22 16:16:30 +01:00
Clinton Gormley 7cfdd9ef59 Corrected filter strategy option in FilteredQueryParser
Changed from 'query_filter' to 'query_first'
2013-01-22 12:54:00 +01:00
Simon Willnauer 0b730aae81 Pass on filterStrategy in XFilteredQuery if query is rewritten 2013-01-22 12:40:21 +01:00
Martijn van Groningen a5bd57ed6c Added trace log statement, to catch stacktraces 2013-01-20 23:17:18 +01:00
Simon Willnauer 35cf9ee11d wait for cluster to be formed in SimpleNodesInfoTests 2013-01-19 15:44:26 +01:00
Simon Willnauer d6b613ac8c Respect lowercase_expanded_terms in MappingQueryParser
Fixes #2566
2013-01-19 13:57:45 +01:00
Simon Willnauer 31fd521fd1 provide more information if a null DocumentMapper is returned 2013-01-18 16:43:56 +01:00
Simon Willnauer c563248f76 testMoreLikeThisIssue2197 should create index mapping first to prevent races 2013-01-18 16:41:37 +01:00
Simon Willnauer 6f38a3a8a8 create index and mapping first to ensure all relevant nodes see the mapping 2013-01-18 16:09:24 +01:00
Simon Willnauer 393de984bd Remove deprecated StreamInput/Output#read/writeUTF 2013-01-17 22:38:42 +01:00
Simon Willnauer d37c844da0 use camelcase for getters 2013-01-17 22:27:44 +01:00
Simon Willnauer 3d80c53192 Allow ShardsAllocator to be configured via node level settings.
* Default ShardsAllocator is set to BalancedShardsAllocator
* Core ShardsAllocator implementations can be defined via 'cluster.routing.allocation.type'
* Core ShardsAllocator implementations are exposed via short keys 'balanced' (BalancedShardsAllocator) and 'even_shards' (EvenShardsCountAllocator)
* Third party allocators can be loaded via fully-qualified class names.

Closes #2557
2013-01-17 16:23:52 +01:00
Simon Willnauer 2eb09e6b1a Added BalancedShardsAllocator that balances shards based on a weight function.
* Weights are calculated per index and incorporate index level, global and primary related parameters
 * Balance operations are executed based on a win maximation strategy that tries to relocate shards
   first that offer the biggest gain towards the weight functions optimum
 * The WeightFunction allows settings to prefer index based balance over global balance and vice versa
 * Balance operations can be throttled by raising a threshold resulting in less agressive balance operations
 * WeightFunction shipps with defaults to achive evenly distributed indexes while maintaining a global balance

Closes #2555
2013-01-17 12:02:42 +01:00
Igor Motov d97839b8a8 Fix char filter issues introduced during lucene 4 migration
Fixes #2543
2013-01-14 12:43:02 -05:00
Igor Motov e82f96f1e5 Make script cache configurable and bounded
Fixes #2539
2013-01-14 06:57:13 -05:00
Igor Motov 6243f8e64d Disallow unknown custom indexing parameters
Fixes #2354
2013-01-11 10:14:25 -05:00
Martijn van Groningen 1ce10dfb06 Fixed issue where parent & child queries can fail if a segment doesn't have documents with the targeted type or associated parent type
Closes #2537
2013-01-11 16:06:14 +01:00
Martijn van Groningen 43aabe88e8 Fixed document already exists error when concurrently sending update request with upsert using the same id.
Closes #2530
2013-01-10 14:25:44 +01:00
Shay Banon 6f7253c524 Comments are not allowed in mapping
checked jackson, there won't be an overhead in enabling comments. Added, with the caveat that when used with mappings, and calling "get mapping", the comments will not be returned
closes #1394
2013-01-07 04:21:41 +01:00
Shay Banon 2c4b9d9ba2 cleanup queryHint since its not was never used
preference ended up as the way to control routing
2013-01-07 04:02:45 +01:00
Shay Banon bcdda811ef add read/write optional text 2013-01-07 02:54:22 +01:00
Shay Banon 0e5287f1f2 Binary Mapped Fields: Allow to not store them by default, and return BytesReference
fixes #2523
also, fix another point of normalization of the result for get API
2013-01-05 01:50:46 +01:00
Shay Banon 4b9fcdb900 noramalize the value even when getting it from source
we need to in order to properly handle bytes, and normalize Integer to Long for example for consistency, the fact that mappers now handle different Objtes help here
2013-01-04 23:55:34 +01:00
Shay Banon fe38cecabd return the string for date types if passed for search 2013-01-04 23:31:49 +01:00
Shay Banon bf4c442509 add refresh before calling count 2013-01-04 08:38:00 +01:00
Shay Banon 70f1e2c987 remove problematic timeout test
the timeout feature, even if set to 0, might still mean we get an ack back...
2013-01-04 08:19:01 +01:00
Shay Banon e70cf1849b check on sourceRef, so it won't convert to bytes without needing to 2013-01-04 07:47:26 +01:00
Igor Motov d73a6663b7 Changing non-nested object mapping to nested should fail
Fixes #2518
2013-01-03 18:18:40 -05:00
uboness dc25939b7c fixed hunspell test to clean up properly, this time, for realz 2013-01-03 22:54:37 +01:00
uboness 86f55b3a45 fixed hunspell test to clean up properly 2013-01-03 22:12:36 +01:00
Martijn van Groningen 7cf80aca99 Changed how the stored values of numeric fields are stored in the index. Before numeric values were stored in binary representation, now the values in numeric representation. 2013-01-03 21:34:53 +01:00
Shay Banon 0032b334c5 add simple way to get the index creation version when building a mapper 2013-01-03 19:06:19 +01:00
uboness 9f60dc7578 Support for root logger level runtime update
Closes: #2517
2013-01-03 01:23:40 +01:00
uboness 6c4108b38a Support for hunspell token filter
Closes: #646

- Introduced HunspellService which holds a repository of hunspell dictionaries
- It is possible to register a dictionary via a plugin or by placing the dictionary files on the file system
2013-01-02 03:51:26 +01:00
Shay Banon 720feca3c5 optimize search hit to use Text for type and id
this will reduce serialization string overheads, and faster xcontent(json) generation
2012-12-31 00:13:15 -08:00
Shay Banon 120b766f0a cleanup 2012-12-30 17:39:19 -08:00
Shay Banon 4a5b147634 remove unused method 2012-12-30 17:37:46 -08:00
Shay Banon 22077d1c5f move regex to use Object as paramater as well 2012-12-30 17:36:48 -08:00
Shay Banon f8a08a46ac cleanup more calls to Term with String value 2012-12-30 17:31:13 -08:00
Shay Banon 1c93c8dfb8 cleanup unused term factory 2012-12-30 16:55:22 -08:00
Shay Banon 7f0034d42f fix thread pool stats largest 2012-12-30 01:57:18 -08:00
Shay Banon b6f766af3f backport lucene 4.1 terms filter and use it where applicable 2012-12-29 10:39:53 -08:00
Shay Banon b08e8fb76c add explicit termsFilter in mapper, and use that in terms filter
This also enabled support for terms filter on _id field for example
2012-12-29 01:06:32 -08:00
Shay Banon 2655c2aa58 fix index xcontent flag with id 2012-12-29 00:46:35 -08:00
Shay Banon 9a8d558e51 use object parser value for queries that support it 2012-12-29 00:14:46 -08:00
Shay Banon fd5719b232 support multiple values when mappers construct queries
this will allow us to optimize parsing using actual values (numbers/bytes)
2012-12-28 23:38:43 -08:00
Shay Banon 01ba287164 more mapper simplification, reduce the value methods 2012-12-28 20:33:10 -08:00
Shay Banon e02015c641 Use FieldType and not deprecated Field construction 2012-12-28 14:27:09 -08:00
Shay Banon 64a01c28c3 rename fieldQuery/fieldFilter to termQuery/termFilter in mappers 2012-12-28 13:48:48 -08:00
Shay Banon 12239169b1 add 0.20.3 2012-12-27 14:30:40 -08:00
Shay Banon 7fb98769a6 add a sleep to make sure settings are applied 2012-12-27 14:16:30 -08:00
Igor Motov b7ff23ff93 Update settings: Allow to dynamically update thread pool settings
Closes #2509
2012-12-27 09:39:27 -05:00
Shay Banon 6ef0e4ddda fix type to types 2012-12-26 16:31:55 -08:00
Shay Banon 660d0ceba9 cleanup 2012-12-26 16:18:57 -08:00
Simon Willnauer 750c30f0b8 allow index and type to be specified as arrays in MultiSearchRequest 2012-12-26 16:18:17 -08:00
Dave Brosius 6342beeeb0 fix copy/paste bug where null stopWords is passed causing an NPE 2012-12-26 16:16:37 -08:00
Shay Banon ef55e4feec fix failed tests due to wrapping failures with mapping parsing exception 2012-12-26 15:59:07 -08:00
Shay Banon 7a0404ac35 optimize filtered query with match_all filter
simply just use the query in that case, and don't add the filter overhead
2012-12-26 15:47:53 -08:00
Shay Banon 8a17222ff2 match_all filter with empty array (instead of obj) fires exception when used with facets
fixes #2493
2012-12-26 15:35:30 -08:00
Shay Banon 2a57e7cd4b ShardSearchFailure handling of exception does not take actual into account for status
fixes #2495
2012-12-26 15:00:49 -08:00
Shay Banon 2f4b759df7 Allow highlighting on wildcard fields.. ie, comment_*
closes #2396
2012-12-26 15:00:31 -08:00
Shay Banon 4b69846ba2 cleanup 2012-12-26 14:21:04 -08:00
Simon Willnauer 90bd82ac50 Pass topScorer=false to sub-scorers if a scorer is wrapped. Wrapped BooleanQuery can return collect-only scorers. See #2505 2012-12-26 14:20:14 -08:00
Shay Banon 2449049a84 Plugins Installer: Allow to download plugins from download.elasticsearch.org
closes #2507.
2012-12-26 14:16:35 -08:00
Martijn van Groningen c93babed42 Minor changes to the parent / child benchmark. 2012-12-24 22:12:10 +01:00
Martijn van Groningen c6aaefa27f Improved explain support for nested query.
Closes #2503
2012-12-24 13:40:20 +01:00
Martijn van Groningen d57d89937f Added scoring support to `has_child` and `has_parent` queries.
Added score support to `has_child` and `has_parent` queries. Both queries support a score_type option. The has_child support the same options as the top_children query and the none option which is the default and yields the current behaviour. The has_parent query support the score type options: score and none. The latter is the default and yields the current behaviour.

If the score_type is set to a value other than none then the has_parent query map the matched parent score into the related children documents. The has_child query then map the matched children documents into the related parent document. The score_type on both queries defines how the children documents scores are mapped in the parent documents. Both queries are executed in two phases. First phase collects the parent uid values of matching documents with an aggregated score per parent uid value. In the second phase either child or parent typed documents are emitted as hit that have the same parent uid value as found during the first phase. The score computed in the first phase will be used as score.

Closes #2502
2012-12-24 11:39:43 +01:00
Shay Banon bb9c7172b0 add mappings even on failure to parse
since we add them internally to the compound mappers, we need to publish the fact, otherwise, for example, the codec won't find the relevant one based on the global mapper service
2012-12-24 00:04:29 -08:00
Igor Motov fcdc36977c Fix failure message serialization in MultiSearchResponse
Fixes #2498
2012-12-21 19:26:48 -05:00
Martijn van Groningen 08b026d060 Fixed `top_children` query failure with dfs_query* search types.
Fixed error with the top_children query when `DFS_QUERY_*` is used as search_type and wraps a query that gets rewritten (E.g wildcard query).

Closes #2501
2012-12-21 18:08:44 +01:00
Martijn van Groningen c17755d164 Removed unused code. 2012-12-21 16:54:14 +01:00
Martijn van Groningen 694989141b Fixed AOBE when using `top_children` in a must not clause.
Closes #2500
2012-12-21 16:47:03 +01:00
Martijn van Groningen 826a6ab02a Improved XBooleanFilter by adding drive logic for bit based filter impl and adding unit test, which tests all possible XBooleanFilter options. 2012-12-19 22:43:47 +01:00
Shay Banon 14678a91ab nested path to be represented as bytes as well as string 2012-12-18 15:39:13 -08:00
Shay Banon 2950799243 fix creating uid to bytes 2012-12-18 14:39:25 -08:00
Shay Banon ac253178bd more cleanup in mappings 2012-12-18 13:28:36 -08:00
Shay Banon 1867ef5084 simplify toXContent generation of field mappers 2012-12-18 13:00:47 -08:00
Shay Banon f3dbe9224a rename analyzed to tokenized to match field type 2012-12-18 11:34:41 -08:00
Shay Banon b9c5f0472c indexedTerm to return bytes
part of the effort to reduce conversion from string to types
2012-12-18 10:58:03 -08:00
Shay Banon 1cb531f000 remove unused code 2012-12-18 10:26:52 -08:00
Shay Banon e41def7a59 remove unused code 2012-12-18 10:22:37 -08:00
Shay Banon f01ce61f71 parse to bytes 2012-12-18 10:20:55 -08:00
Martijn van Groningen afd998c482 Improved the size computation in StringFieldData#computeSizeInBytes() 2012-12-18 09:51:01 +01:00
Martijn van Groningen ddea22771e Fixed mlt api bug related to custom routing value.
If the a routing value isn't id based, the get part of the mlt request couldn't retrieve the document for the second part of the mlt request and a 500 code is returned instead. This fix addresses this issue.

Closes #2489
2012-12-17 11:00:30 +01:00
uboness 8b74c42099 Support for RegexpQuery & RegexpFilter
- Added "regexp" query type (based on Lucene 4 RegexpQuery)
- Added "regexp" filter type
- Fixed a bug in IdFieldMapper where prefixQuery on a single type would be redundantly wrapped in a boolean query
2012-12-16 23:24:18 +01:00
Shay Banon 5a6004a168 First indexing of a dynamic boolean field can cause it not to be indexed correctly
fixes #2487
2012-12-15 19:04:10 -08:00
Igor Motov c8285739d2 Correctly parse *:* query into matchAllDocsQuery
Fixes #2486
2012-12-14 14:36:20 -08:00
Martijn van Groningen 148dc3c013 Added Lucene 4.1 todo 2012-12-14 16:08:37 +01:00
Shay Banon c65d5a77c4 reuse non analyzed token stream for string types
so heavyweight token stream won't be created each time
2012-12-12 22:53:48 -08:00