我在本地计算机上安装了弹性搜索,我想将其配置为群集中唯一的单个节点(独立服务器).这意味着每当我创建一个新索引时,它只能用于我的服务器.其他服务器无法访问它.
我目前的情况是这些索引可供其他服务器使用(服务器在群集中形成),并且他们可以对我的索引进行任何更改.但我不想要它.
我浏览了一些其他博客,但没有得到最佳解决方案.那么请你告诉我相同的步骤吗?
在我的弹性搜索服务器中,我有一个索引http://localhost:9200/blog
.
(博客)索引包含多种类型.
例如:http://localhost:9200/blog/posts
,http://localhost:9200/blog/tags
.
在标签类型中,我创建了超过1000个标签和10个帖子类型的帖子.
例如:帖子
{
"_index":"blog",
"_type":"posts",
"_id":"1",
"_version":3,
"found":true,
"_source" : {
"catalogId" : "1",
"name" : "cricket",
"url" : "http://www.wikipedia/cricket"
}
}
Run Code Online (Sandbox Code Playgroud)
例如:标签
{
"_index":"blog",
"_type":"tags",
"_id":"1",
"_version":3,
"found":true,
"_source" : {
"tagId" : "1",
"name" : "game"
}
}
Run Code Online (Sandbox Code Playgroud)
我想将现有标签分配给博客帖子(即relationship => mapping).
如何将标签分配给帖子映射?
弹性搜索中是否有一种方法可以提高文档中出现的确切短语的重要性?
例如,如果我正在搜索短语"web开发人员",并且如果单词"web developer"一起出现,那么与在整个文档中单独出现的"web"和"developer"相比,它们将被提升5.因此,任何包含"web开发者"的文档将首先出现在结果中.
下面给出的是我使用elasticsearch.Index生成索引的代码成功生成.基本上我用它来生成autosuggest,具体取决于电影名称,演员姓名和gener.
现在我的要求是,我需要将子字符串与特定字段匹配.如果我使用它,这工作正常$params['body']['query']['wildcard']['field'] = '*sub_word*';
.(即搜索'to'给'tom kruz'但搜索'tom kr'不返回结果).
这只匹配string中的特定单词.我想匹配包含多个单词的子串(即'tom kr'应该返回'tom kruz').
我找到了很少的文档,说使用' ngram ' 是可能的.但我不知道,我应该如何在我的代码中实现它,因为我使用基于数组的弹性搜索配置,所有支持文档都提到了json fromat中的配置.
请帮忙.
require 'vendor/autoload.php';
$client = \Elasticsearch\ClientBuilder::create()
->setHosts(['http://localhost:9200'])->build();
/*************Index a document****************/
$params = ['body' => []];
$j = 1;
for ($i = 1; $i <= 100; $i++) {
$params['body'][] = [
'index' => [
'_index' => 'pvrmod',
'_type' => 'movie',
'_id' => $i
]
];
if ($i % 10 == 0)
$j++;
$params['body'][] = [
'title' => 'salaman khaan'.$j,
'desc' => 'salaman khaan description'.$j,
'gener' …
Run Code Online (Sandbox Code Playgroud) 我有一个产品目录,我使用Elastica客户端在ElasticSearch中编制索引.我是ElasticSearch BTW的新手.
我的目录中有些产品有't-shirt'
其名称.但是,如果我输入,它们将不会出现在搜索结果中'tshirt'
.
我能做什么,'t-shirt'
也可以弹出结果?
我已经按照本教程并为索引实现了以下内容:
'analysis' => array(
'analyzer' => array(
'indexAnalyzer' => array(
'type' => 'custom',
'tokenizer' => 'whitespace',
'filter' => array('lowercase', 'mySnowball')
),
'searchAnalyzer' => array(
'type' => 'custom',
'tokenizer' => 'whitespace',
'filter' => array('lowercase', 'mySnowball')
)
),
'filter' => array(
'mySnowball' => array(
'type' => 'snowball',
'language' => 'English'
)
)
)
Run Code Online (Sandbox Code Playgroud) 我想让FOSElasticaBundle工作.ElasticSearch Instance正在localhost:9200上运行并响应.
我按照文档中的每一步https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md
但在最后一步,我在我的控制台中收到此错误:
c:\xampp\htdocs\my\folder>php app/console fos:elastica:populate
Resetting app
Fatal error: Wrong parameters for Exception([string $exception [, long $code [,
Exception $previous = NULL]]]) in C:\xampp\htdocs\my\folder\vendor\rufli
n\elastica\lib\Elastica\Exception\ResponseException.php on line 34
[Symfony\Component\Debug\Exception\FatalErrorException]
Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])
fos:elastica:populate [--index[="..."]] [--type[="..."]] [--no-reset] [--offset="..."] [--sleep="..."] [--batch-size="..."] [--ignore-errors] [--no-overwrite-format]
Run Code Online (Sandbox Code Playgroud)
看起来"__construct"-Function必须有3个参数,但只有2个参数.我只是尝试添加"NULL"参数以使其工作,但随后另一个函数抛出错误.
public function __construct(Request $request, Response $response)
{
$this->_request = $request;
$this->_response = $response;
parent::__construct($response->getError());
}
Run Code Online (Sandbox Code Playgroud)
这是个常见的问题吗?我该如何解决?
我在使用 FOSElastica 捆绑包配置时遇到问题。我使用 JMS 序列化器,并尝试添加具有实际上包含 json 数组的字段的对象。但是,当我尝试填充其中一些时,它给了我这些错误:
Error in one or more bulk request actions:
index: /table_content/table_content/10 caused mapper [corrected_value_float.args.argument1] cannot be changed from type [long] to [float]
index: /table_content/table_content/11 caused mapper [difference_value_float.entry] cannot be changed from type [float] to [long]
Run Code Online (Sandbox Code Playgroud)
目前,我无法理解他如何推断 json 数组中参数的类型。需要明确的是,我认为 JMS 只是像其他任何对象一样序列化对象并将 {"field" : "value"} 关联为 json,这里数据库中的 "value" 是一个实际的 json 数组,因此 elastica 对其进行索引并类似于“猜测”数组值的类型。
/table_content/table_content/10 有问题的 json 数组(我猜测他不喜欢“argument1”末尾的 100):
{
"args": {
"argument1":[0.0002777777777777778,1.123888888888889,2.2475,3.371111111111111,4.494722222222222,5.618333333333334,6.741944444444444,7.865555555555555,8.988888888888889,10.112499999999999,11.23611111111111,12.359722222222222,13.483333333333333,14.606944444444444,15.730555555555556,16.854166666666668,17.977777777777778,19.10138888888889,20.224999999999998,21.34861111111111,22.47222222222222,23.59583333333333,24.71944444444444,25.842777777777776,26.96638888888889,28.09,29.21361111111111,30.33722222222222,31.460833333333333,32.58444444444444,33.70805555555556,34.83166666666667,35.95527777777778,37.07888888888889,38.2025,39.32611111111112,40.44972222222222,41.57333333333334,42.696666666666665,43.82027777777778,44.943888888888885,46.0675,47.191111111111105,48.31472222222222,49.43833333333333,50.56194444444444,51.68555555555555,52.80916666666666,53.93277777777777,55.05638888888888,56.18,57.30361111111111,58.426944444444445,59.550555555555555,60.674166666666665,61.797777777777775,62.921388888888885,64.045,65.16861111111112,66.29222222222222,67.41583333333334,68.53944444444444,69.66305555555556,70.78666666666666,71.91027777777778,73.03388888888888,74.1575,75.28083333333333,76.40444444444445,77.52805555555555,78.65166666666667,79.77527777777777,80.89888888888889,82.0225,83.14611111111111,84.26972222222223,85.39333333333335,86.51694444444445,87.64055555555557,88.76416666666667,89.88777777777779,91.01138888888889,92.13472222222222,93.25833333333334,94.38194444444444,95.50555555555556,96.62916666666666,97.75277777777778,98.87638888888888,100]
}
}
Run Code Online (Sandbox Code Playgroud)
/table_content/table_content/11 有问题的 json 数组:
{"args": {
"entry":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
}
Run Code Online (Sandbox Code Playgroud)
对于第二个有问题的数组,我什至不明白为什么他认为其中一个数字是浮点数,而它只由 0 组成。 …
在我的 symfony2 应用程序中,我使用 FOS Elastica 捆绑包来执行搜索。
我尝试设置分析器和过滤器,但似乎它们没有效果。例如,如果我搜索单词“蛋糕”,则不会返回包含句子大小写“蛋糕”的对象。
如何正确配置这些分析器和过滤器?
我的配置:
#Elastic Search
fos_elastica:
default_manager: orm
clients:
default: { host: localhost, port: 9200 }
indexes:
website:
client: default
settings:
index:
analysis:
analyzer:
custom_index_analyzer :
type : custom
tokenizer: nGram
filter : [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
custom_search_analyzer :
type : custom
tokenizer: nGram
filter : [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
tokenizer:
nGram:
type: nGram
min_gram: 1
max_gram: 2
filter:
snowball:
type: snowball
language: French
elision:
type: elision
articles: [l, m, …
Run Code Online (Sandbox Code Playgroud) 你好我有一个问题..
我有我的 elastica 存储库
namespace XX\xxx;
use FOS\ElasticaBundle\Repository;
class TestRepository extends Repository
{
public function getExamples($argOne, $argTwo) {
$query = new BoolQuery();
$matchOne = new Match();
$matchOne->setField('column_one', $argOne);
$query->addMust($matchOne);
$matchTwo = new Match();
$matchOne->setField('column_two', $argTwo);
$query->addMust($matchTwo);
return $this->find($query);
}
}
Run Code Online (Sandbox Code Playgroud)
和测绘
...
types:
example:
mappings:
column_one:
type: integer
column_two:
type: string
column_three:
type: date
Run Code Online (Sandbox Code Playgroud)
我的问题是..
我需要按第三列获取查询组。我不知道该怎么做。
我将不胜感激的信息..
我正在尝试添加到我的 elasticsearch.yml
index.max_result_window: 10000
Run Code Online (Sandbox Code Playgroud)
但问题是它不喜欢我添加index.
配置(它会导致错误),这在 elastica 2.X 版中有效,但现在在 6.X 中似乎不起作用。知道如何在最近的 elastica 版本中配置索引吗?我似乎无法找到答案。
elastica ×10
symfony ×4
php ×2
analyzer ×1
exception ×1
mapping ×1
query-string ×1
relationship ×1
search ×1
term ×1