A
A
Apostol632019-12-13 15:40:01
PHP
Apostol63, 2019-12-13 15:40:01

Why does elasticsearch only search in one field?

Good day everyone.
I don’t understand a little here why elasticsearch searches for only one field, namely title.
Here is the indexing (I index the .docx file using ingest-attachment):

$fullfile = __DIR__.'/prrr23.docx';
      $params = [
          'index' => 'factoryfiles',
          'type'  => 'files',
          'id'    => 'testId',
          'pipeline' => 'filesNtd',
          'body'  => [
              'contentdocs' => base64_encode(file_get_contents($fullfile)),
              'title' => 'Заголовок тестового документа',
          ],
      ];


      $x = $this->obj->index($params);

And here is the search
$query = [
        'multi_match' => [
            'query' => '*жирным*',
            'fields' => ['title', 'contentdocs'],
        ],
    ];
        $searchParams = [
          'index' => 'factoryfiles',
          'type' => 'files',
          'body' => [
              'query' => $query
            ],
      ];
      $x = $this->obj->search($searchParams);

Those. if the search word in the query field is in the title at the index, then everything is displayed without problems, but if in the text of the document itself and goes to the contentdocs field, then the search does not occur
Please tell me what I'm doing wrong
Thank you in advance and everyone on Friday)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question