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

return highlight to response #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Akiler520
Copy link

@Akiler520 Akiler520 commented Aug 22, 2018

return highlight to response

e.g.

    `$json = '{
            "query" : {
                    "match": { "name": "淳于理群" }
            },
            "highlight" : {
                "fields" : {
                    "name" : {}
                 }
            }
        }';
    $result = json_decode($json);

    $documents = ES::type('product_list')->body($result)->get();

    if ($documents){
        foreach ($documents as $document) {
            var_dump(json_encode($document->attributes));exit;
        }
    }

`

result:

    {
        "name":"淳于理群",
        "last_name":"",
        "age":57,
        "about":"淳于理群很喜欢足球,喜欢看报纸,也喜欢游泳",
        "interests":[
                "上网聊天",
                "滑雪"
            ],
        "_index":"product",
        "_type":"product_list",
        "_id":"06uFW2UB12PvfbBPiLfC",
        "_score":18.34602,
        "_highlight":{
                "name":[
                    "<em>淳</em><em>于</em><em>理</em><em>群</em>"
                ]
        }
    }

return highlight
@Akiler520 Akiler520 changed the title Update Query.php return highlight to response Aug 22, 2018
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

Successfully merging this pull request may close these issues.

1 participant