Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add "keyword" and "text" field types in the mapping? #147

Open
andrey-bahrachev opened this issue Mar 8, 2018 · 5 comments
Open

Comments

@andrey-bahrachev
Copy link

Hey there,
I managed to make this package work with ES6, but as long as the "string" data type has been dropped there, I'm trying to add the "keyword" and "text" fields in the mapping like this:
$map->addField('keyword', 'type');
$map->addField('text', 'description');
But for some reason those fields are being ignored and they do not appear in the mapping at all. Any ideas why?

@killtw
Copy link
Contributor

killtw commented Mar 18, 2018

You should take a look at Grammer

@andrey-bahrachev
Copy link
Author

@killtw I just went lower level with Elasticsearch\Client itself and problem solved.
Still the support for those fields should be added in the upcoming release of this package.

@thitami
Copy link

thitami commented Jun 7, 2018

@andrey-bahrachev How did you resolve this issue? Could you provide an example?

@andrey-bahrachev
Copy link
Author

@thitami Do something like this:

$client = Plastic::getClient();

$params = [
    'index' => 'your-index-name',
    'type' => '_doc',
    'body' => [
        '_doc' => [
            '_source' => [
                'enabled' => true,
            ],
            'properties' => [
                'uuid' => [
                    'type' => 'keyword',
                ],
                'path' => [
                    'type' => 'text',
                ],
            ],
        ],
    ],
];

$client->indices()->putMapping($params);

@thitami
Copy link

thitami commented Jun 7, 2018

Thanks alot , @andrey-bahrachev. Appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants